#
# HoI - Republican Spain Events
#
#		written by Henrik Fåhraeus
#

#########################################################################
#  Spanish Civil War
#########################################################################
event = {
	id = 3100
	random = no
	country = SPR

	trigger = {
		NOT = {
			exists = SPA
		}
		atwar = no
		OR = {
			government = communist
			government = democratic
		}
	}

	name = "EVT_3100_NAME"
	desc = "EVT_3100_DESC"
	style = 0
	picture = "SCW"

	date = { day = 16 month = july year = 1936 }

	action_a = {
		name = "OK" # En la Defensa de la Democracia!
		command = { type = set_domestic which = democratic value = 7 }
		command = { type = set_domestic which = political_left value = 6 }
		command = { type = civil_war which = SPA }
		command = { type = add_division value = militia }
		command = { type = add_division value = militia }
		command = { type = add_division value = militia }
		command = { type = add_division value = militia }
		command = { type = add_division value = infantry }
		command = { type = add_division value = infantry }
		command = { type = add_division value = infantry }
		command = { type = add_division value = infantry }
		command = { type = add_division value = infantry }
		command = { type = add_division value = infantry when = 0 }
		command = { type = add_division value = infantry when = 0 }
		command = { type = add_division value = infantry when = 0 }
		command = { type = headofstate which = 11033 } #Azaña
		command = { type = headofgovernment which = 11062 } #Largo Caballero
		command = { type = foreignminister which = 11096 } #Barcia Trelles
		command = { type = armamentminister which = 11144 } #Giner de los Rios
		command = { type = ministerofsecurity which = 11189 } #Azcarate
		command = { type = ministerofintelligence which = 11217 } #Balboa
		command = { type = chiefofstaff which = 11007 } #Miaja
		command = { type = chiefofarmy which = 11291 } #Miaja
		command = { type = chiefofnavy which = 11309 } #Giral
		command = { type = chiefofair which = 11321 } #Hidalgo de Cisneros

		command = { type = relation which = ENG value = 10 }
		command = { type = relation which = FRA value = 10 }
		command = { type = relation which = SOV value = 5 }
		command = { type = relation which = USA value = 5 }
		command = { type = relation which = GER value = -15 }
		command = { type = relation which = ITA value = -10 }
		command = { type = relation which = POR value = -10 }

		#command = { type = add_division which = "Milicias CNT" value = militia when = 0 }
		#command = { type = add_division which = "Milicias POUM" value = militia when = 0 }
		command = { type = dissent value = 25 }

		#command = { type = trigger which = 3107 }
	}
}

#########################################################################
#  Communist Coup - Anarchist movement crushed
#########################################################################
event = {
	id = 3101
	random = no
	country = SPR

	name = "EVT_3101_NAME"
	desc = "EVT_3101_DESC"
	style = 0
	picture = "SPR_Communist_Coup"

	trigger = {
		random = 7
		NOT = {
			government = communist
			exists = SPA
			war = { country = SPA country = SPR }
		}
	}

	# Note: historical date: May 3, 1937
	date = { day = 3 month = april year = 1937 }
	offset = 7
	deathdate = { day = 3 month = june year = 1937 }

	action_a = {
		name = "OK"
		command = { type = set_domestic which = democratic value = 5 } 
		command = { type = set_domestic which = political_left value = 9 }
		command = { type = revolt which = 357 } #Barcelona Uprising-Pending balancing
		command = { type = headofstate which = 11046 }
		command = { type = headofgovernment which = 11060 }
		command = { type = foreignminister which = 11092 }
		command = { type = armamentminister which = 11134 }
		command = { type = ministerofsecurity which = 11176 }
		command = { type = ministerofintelligence which = 11217 }
		command = { type = chiefofstaff which = 11247 }
		command = { type = chiefofarmy which = 11277 }
		command = { type = chiefofnavy which = 11305 }
		command = { type = chiefofair which = 11010 }
		command = { type = domestic which = freedom value = -1 }
		command = { type = relation which = SOV value = 20 }
		command = { type = relation which = ENG value = -10 }
		command = { type = relation which = FRA value = -10 }
		command = { type = relation which = GER value = -20 }
		command = { type = relation which = ITA value = -20 }
		command = { type = relation which = USA value = -5 }
		command = { type = relation which = POR value = -15 }
		command = { type = dissent value = 10 }

		command = { type = sleepleader which = 3007 }
		command = { type = sleepleader which = 3050 }
	}
}

#########################################################################
#  Spanish Civil War - Soviet Intervention
#########################################################################
event = {
	id = 3102
	random = no
	country = SPR

	# Triggered by SOV 2623

	name = "EVT_3102_NAME"
	desc = "EVT_3102_DESC"
	style = 0
	picture = "SCW_Soviet Intervention"

	action_a = {
		name = "OK" # Great!
		command = { type = money value = -100 }
		command = { type = manpowerpool value = 10 }
		command = { type = oilpool value = 200 } 
		command = { type = supplies value = 2500 }
		command = { type = add_division which = "Carros Soviéticos" value = armor when = 1 }
		command = { type = add_division which = "Brigadas Internacionales" value = infantry when = 0 }
		command = { type = add_division which = "Cazas soviéticos" value = interceptor when = 1 }
		command = { type = add_division which = "Katiuskas soviéticos" value = tactical_bomber when = 1 }
		command = { type = steal_tech which = SOV }

		command = { type = wakeleader which = 3007 }
		command = { type = wakeleader which = 3050 }
	}
}
#########################################################################
#  Spanish Civil War - UK Intervention
#########################################################################
event = {
	id = 3103
	random = no
	country = SPR

	# Triggered by UK

	name = "EVT_3103_NAME"
	desc = "EVT_3103_DESC"
        picture = "spanish_civil_war_uk"
	style = 0

	action_a = {
		name = "OK" # Great!
		command = { type = manpowerpool value = 10 }
		command = { type = supplies value = 1500 }
		command = { type = add_division value = infantry when = 0 }
	}
}
#########################################################################
#  Spanish Civil War - French Intervention
#########################################################################
event = {
	id = 3104
	random = no
	country = SPR

	# Triggered by FRA

	name = "EVT_3104_NAME"
	desc = "EVT_3104_DESC"
	style = 0
	picture = "SCW_French Intervention"

	action_a = {
		name = "OK" # Great!
		command = { type = manpowerpool value = 10 }
		command = { type = supplies value = 1500 }
		command = { type = add_division value = infantry when = 0 }
	}
}
#########################################################################
#  Democracy Defended - Germany don't support the Nationalists
#########################################################################
event = {
	id = 3105
	random = no
	country = SPR

	# Triggered by GER2023

	name = "EVT_3105_NAME"
	desc = "EVT_3105_DESC"
	style = 0
	picture = "SCW"

	action_a = {
		name = "OK" # Great!
		command = { type = manpowerpool value = 40 }
		command = { type = supplies value = 1500 }
		command = { type = add_division value = infantry when = 0 }
		command = { type = add_division value = infantry when = 0 }
		command = { type = add_division value = infantry when = 0 }
	}
}
#########################################################################
#  Democracy Defended - Italy don't support the Nationalists
#########################################################################
event = {
	id = 3106
	random = no
	country = SPR

	# Triggered by ITA2901

	name = "EVT_3106_NAME"
	desc = "EVT_3105_DESC"
	style = 0
	picture = "SCW"

	action_a = {
		name = "OK" # Great!
		command = { type = manpowerpool value = 40 }
		command = { type = supplies value = 1500 }
		command = { type = add_division value = infantry when = 0 }
		command = { type = add_division value = infantry when = 0 }
		command = { type = add_division value = infantry when = 0 }
	}
}

#########################################################################
#  Spanish Civil War - Follow up event - Ceding oversea provinces to SPA
#########################################################################
event = {
	id = 3107
	random = no
	country = SPR

	trigger = {
		event = 3100 
		exists = SPA
		war = { country = SPA country = SPR }
	}

	name = "EVT_3107_NAME"
	desc = "EVT_3107_DESC"
	style = 0
	picture = "SCW"

	date = { day = 16 month = july year = 1936 }
	offset = 1
	deathdate = { day = 30 month = december year = 1963 }

	action_a = {
		name = "OK" # En la Defensa de la Democracia!
		command = { type = secedeprovince which = SPA value = 535 } # Mallorca
		command = { type = secedeprovince which = SPA value = 536 } # Menorca
		command = { type = secedeprovince which = SPA value = 537 } # Ibiza
		command = { type = secedeprovince which = SPA value = 954 } # Melilla
		command = { type = secedeprovince which = SPA value = 955 } # Villa Sanjurjo
		command = { type = secedeprovince which = SPA value = 957 } # Ceuta
		command = { type = secedeprovince which = SPA value = 961 } # Lanzarote
		command = { type = secedeprovince which = SPA value = 962 } # Fuerteventura
		command = { type = secedeprovince which = SPA value = 963 } # Gran Canaria
		command = { type = secedeprovince which = SPA value = 964 } # Tenerife
		command = { type = secedeprovince which = SPA value = 965 } # La Palma
		command = { type = secedeprovince which = SPA value = 967 } # Ifni
		command = { type = secedeprovince which = SPA value = 971 } # El Aaiún
		command = { type = secedeprovince which = SPA value = 972 } # Villa Cisneros
		command = { type = secedeprovince which = SPA value = 1091 } # Bata
	}
}

#########################################################################
# Republican Spain wins the Civil War
#########################################################################
event = {
	id = 3108
	random = no
	country = SPR
 
	trigger = {
		owned = { province = 341 data = SPR }
		NOT = { 
			exists = SPA 
			event = 3004 
		}
	}

	name = "EVT_3108_NAME" 
	desc = "EVT_3108_DESC"
	picture = "Spr_victory"
	date = { day = 18 month = july year = 1936 }
	offset = 5
	deathdate = { day = 30 month = december year = 1999 }

	action_a = {
		name = "OK"
		# In case any Italian & German units given to SPA survives the war.
		command = { type = remove_division which = "Bombarderos Legión Cóndor" value = SPR }
		command = { type = remove_division which = "Cazas Legión Cóndor" value = SPR }
		command = { type = remove_division which = "Blindada Legión Cóndor" value = SPR }
		command = { type = remove_division which = "Littorio" value = SPR }
		command = { type = remove_division which = "Dio lo Vuole" value = SPR }
		command = { type = remove_division which = "Fiamme Nere" value = SPR }
		command = { type = remove_division which = "Penne Nere" value = SPR }
		command = { type = remove_division which = "Bombarderos Aviación Legionaria" value = SPR }
		command = { type = remove_division which = "Cazas Aviación Legionaria" value = SPR }

		# In case any of these four Communist, Anarchist & Fascist militia survive SCW.
		command = { type = remove_division which = "Milicias POUM" value = SPR }
		command = { type = remove_division which = "Milicias CNT" value = SPR }
		command = { type = remove_division which = "1a Milicia Falangista" value = SPR }
		command = { type = remove_division which = "2a Milicia Falangista" value = SPR }
		# Soviet units
		command = { type = remove_division which = "Carros Soviéticos" value = SPR }	
		command = { type = remove_division which = "Brigadas Internacionales" value = SPR }
		command = { type = remove_division which = "Cazas soviéticos" value = SPR }
		command = { type = remove_division which = "Katiuskas soviéticos" value = SPR }

		#foreign leaders / ministers leaving SPR
		command = { type = sleepleader which = 3007 } # Pavel Ivanovich Batov SOV
		command = { type = sleepleader which = 3019 } # Coronel Hans - Hans Kahle DDR
		command = { type = sleepleader which = 3034 } # Gallo - Luigi Longo ITA
		command = { type = sleepleader which = 3038 } # Generale Goméz - Wilhelm Zaisser DDR
		command = { type = sleepleader which = 3046 } # Kléber - Manfred Stern SOV
		command = { type = sleepleader which = 3047 } # Oliver Law USA
		command = { type = sleepleader which = 3050 } # Pavol Lukács - Máté Zalka HUN
		command = { type = sleepleader which = 3064 } # Robert Merriman USA
		command = { type = sleepleader which = 3081 } # Frank Ryan IRE
		command = { type = sleepleader which = 3090 } # Walter - Karol Swierczewski POL - SOV
		command = { type = sleepleader which = 3110 } # Chato - Ivan Trofimovich Yeremenko SOV
		command = { type = sleepleader which = 3117 } # André Malraux FRA
		command = { type = sleepminister which = 11234 } # Frank Ryan CoS
		command = { type = sleepminister which = 11235 } # Kleber / Stern CoS 

		command = { type = sleepevent which = 3004 }	# SPA SCW win event
		command = { type = sleepevent which = 3109 }
		command = { type = capital which = 341 }
		command = { type = relation which = POR value = 3 }
	}
}

###################################################################
# Republican Spain invaded by Germany or Italy during the civil war
###################################################################

event = {
	id = 3109
	random = no
	country = SPR

	trigger = {
		war = { country = SPA country = SPR }
		OR = {
			attack = GER
			attack = ITA
		}
	}

	name = "EVT_3109_NAME"
	desc = "EVT_3109_DESC"
	style = 0

	date = { day = 1 month = january year = 1936 }
	offset = 1
	deathdate = { day = 1 month = january year = 1999 }

	action_a = {
		name = "EVT_3109_ACTION_A"
		command = { type = setflag which = Axis_SCW_Invasion }
	}
}

