####################################
# Spanish Republic AI events 32500 - 32599 by Lothos
####################################
################
# Minister of Security Section 32500 - 32509
#############################################
event = { # Melchor Rodrguez de Galdeano takes power
	id = 32500
	random = no 
	country = SPR
	persistent = yes
	
	trigger = {
		ai = yes
		minister = 11170 # Jos Martnez de Velasco
		NOT = { InCabinet = 11170 }
		OR = {
			manpower = 200
			NOT = { minister = 11183 } # Ams Salvador Carreras
		}
	}

	name = "AI_EVENT"
	style = 0	
	
	date = { day = 1 month = january year = 1936 }
	offset = 7
	deathdate = { day = 29 month = december year = 1999 }

	action_a = {
		command = { type = ministerofsecurity which = 11170 }
		command = { type = dissent value = -1 }
	}
}
event = { # Ams Salvador Carreras takes power
	id = 32501
	random = no 
	country = SPR
	persistent = yes
	
	trigger = {
		ai = yes
		minister = 11183 # Ams Salvador Carreras
		NOT = { InCabinet = 11183 }
		OR = {
			NOT = { manpower = 200 }
			NOT = { minister = 11170 } # Jos Martnez de Velasco
		}
	}

	name = "AI_EVENT"
	style = 0	
	
	date = { day = 1 month = january year = 1936 }
	offset = 7
	deathdate = { day = 29 month = december year = 1999 }

	action_a = {
		command = { type = ministerofsecurity which = 11183 }
		command = { type = dissent value = -1 }
	}
}
################
# Chief of Staff Section 32510 - 32519
#############################################
event = { # Sebastin Pozas Perea power
	id = 32510
	random = no 
	country = SPR
	persistent = yes
	
	trigger = {
		ai = yes
		minister = 11251 # Sebastin Pozas Perea
		NOT = { InCabinet = 11251 }
		atwar = yes
		OR = {
			manpower = 200
			AND = {
				NOT = { manpower = 200 }
				NOT = { minister = 11234 } # Frank Ryan
			}
		}
	}

	name = "AI_EVENT"
	style = 0	
	
	date = { day = 1 month = january year = 1936 }
	offset = 7
	deathdate = { day = 29 month = december year = 1999 }

	action_a = {
		command = { type = chiefofstaff which = 11251 }
		command = { type = dissent value = -1 }
	}
}
event = { # Frank Ryan takes power
	id = 32511
	random = no 
	country = SPR
	persistent = yes
	
	trigger = {
		ai = yes
		minister = 11234 # Frank Ryan
		NOT = { InCabinet = 11234 }
		OR = {
			atwar = no
			NOT = { manpower = 200 }
		}
	}

	name = "AI_EVENT"
	style = 0	
	
	date = { day = 1 month = january year = 1936 }
	offset = 7
	deathdate = { day = 29 month = december year = 1999 }

	action_a = {
		command = { type = chiefofstaff which = 11234 }
		command = { type = dissent value = -1 }
	}
}
################
# Head of Intelligence Section 32520 - 32529
#############################################
event = { # Rafael Videlia Rubio takes power
	id = 32520
	random = no 
	country = SPR
	persistent = yes
	
	trigger = {
		ai = yes
		minister = 11200 # Rafael Videlia Rubio
		NOT = { InCabinet = 11200 }
	}

	name = "AI_EVENT"
	style = 0	
	
	date = { day = 1 month = january year = 1936 }
	offset = 7
	deathdate = { day = 29 month = december year = 1999 }

	action_a = {
		command = { type = ministerofintelligence which = 11200 }
		command = { type = dissent value = -1 }
	}
}
event = { # Manuel Torres Campaa takes power
	id = 32521
	random = no 
	country = SPR
	persistent = yes
	
	trigger = {
		ai = yes
		minister = 11215 # Manuel Torres Campaa
		NOT = { InCabinet = 11215 }
		NOT = { minister = 11200 } # Rafael Videlia Rubio
	}

	name = "AI_EVENT"
	style = 0	
	
	date = { day = 1 month = january year = 1936 }
	offset = 7
	deathdate = { day = 29 month = december year = 1999 }

	action_a = {
		command = { type = ministerofintelligence which = 11215 }
		command = { type = dissent value = -1 }
	}
}
################
# Chief of the Army Section 32530 - 32539
#############################################
event = { # Juan Hernndez Sarabia takes power
	id = 32530
	random = no 
	country = SPR
	persistent = yes
	
	trigger = {
		ai = yes
		atwar = no
		minister = 11276 # Juan Hernndez Sarabia
		NOT = { InCabinet = 11276 }
	}

	name = "AI_EVENT"
	style = 0	
	
	date = { day = 1 month = january year = 1936 }
	offset = 7
	deathdate = { day = 29 month = december year = 1999 }

	action_a = {
		command = { type = chiefofarmy which = 11276 }
		command = { type = dissent value = -1 }
	}
}
event = { # Vicente Guarner Vivancos takes power
	id = 32531
	random = no 
	country = SPR
	persistent = yes
	
	trigger = {
		ai = yes
		atwar = yes
		minister = 11272 # Vicente Guarner Vivancos
		NOT = { InCabinet = 11272 }
	}

	name = "AI_EVENT"
	style = 0	
	
	date = { day = 1 month = january year = 1936 }
	offset = 7
	deathdate = { day = 29 month = december year = 1999 }

	action_a = {
		command = { type = chiefofarmy which = 11272 }
		command = { type = dissent value = -1 }
	}
}
################
# Armament Minister Section 32540 - 32549
#############################################
event = { # Juan Lpez Snchez takes power
	id = 32540
	random = no 
	country = SPR
	persistent = yes
	
	trigger = {
		ai = yes
		minister = 11119 # Juan Lpez Snchez
		NOT = { InCabinet = 11119 }
	}

	name = "AI_EVENT"
	style = 0	
	
	date = { day = 1 month = january year = 1936 }
	offset = 7
	deathdate = { day = 29 month = december year = 1999 }

	action_a = {
		command = { type = armamentminister which = 11119 }
		command = { type = dissent value = -1 }
	}
}
event = { # Belamino Toms lvarez takes power
	id = 32541
	random = no 
	country = SPR
	persistent = yes
	
	trigger = {
		ai = yes
		minister = 11127 # Belamino Toms lvarez
		NOT = { InCabinet = 11127 }
		NOT = { minister = 11119 } # Juan Lpez Snchez
	}

	name = "AI_EVENT"
	style = 0	
	
	date = { day = 1 month = january year = 1936 }
	offset = 7
	deathdate = { day = 29 month = december year = 1999 }

	action_a = {
		command = { type = armamentminister which = 11127 }
		command = { type = dissent value = -1 }
	}
}






################
# Spanish Civil War AI
#############################################
event = {
	id = 32560
	random = no 
	country = SPR
	
	trigger = {
		ai = yes
		war = { country = SPR country = SPA }
	}

	name = "AI_EVENT"
	style = 0	
	
	date = { day = 1 month = january year = 1936 }
	offset = 1
	deathdate = { day = 29 month = december year = 1936 }

	action_a = {
		command = { type = ai which = "switch/SPR_CivilWar.ai" }
		command = { type = ai which = "Air_Ground.ai" }
	}
}
################
# End of Spanish Civil War AI
#############################################
event = {
	id = 32561
	random = no 
	country = SPR
	
	trigger = {
		ai = yes
		event = 32560
		OR = {
			NOT = { exists = SPA }
			NOT = { war = { country = SPR country = SPA } }
		}
	}

	name = "AI_EVENT"
	style = 0	
	
	date = { day = 1 month = january year = 1936 }
	offset = 1
	deathdate = { day = 29 month = december year = 1999 }

	action_a = {
		command = { type = ai which = "switch/SP_EndCivilWar.ai" }
		command = { type = sleepevent which = 32460 }
	}
}

################
# Reinforcements balance events by Pang Bingxun
#############################################

event = { 
	id = 32562
	random = no 
	country = SPR
	persistent = yes

	trigger = {
		ai = yes
		NOT = { local_flag = reinforcement_020 }
		NOT = { manpower = 1 }
	}

	name = "AI_EVENT"
	style = 0
	
	date = { day = 1 month = january year = 1936 }
	offset = 1
	deathdate = { day = 29 month = december year = 1999 }

	action_a = {
		command = { type = ai which = "switch/reinforcement_020.ai" }
		command = { type = local_setflag which = reinforcement_020 }
		command = { type = local_clrflag which = reinforcement_050 }
	}
}

event = { 
	id = 32563
	random = no 
	country = SPR
	persistent = yes

	trigger = {
		ai = yes
		NOT = { local_flag = reinforcement_050 }
		manpower = 3
	}

	name = "AI_EVENT"
	style = 0
	
	date = { day = 1 month = january year = 1936 }
	offset = 1
	deathdate = { day = 29 month = december year = 1999 }

	action_a = {
		command = { type = ai which = "switch/reinforcement_050.ai" }
		command = { type = local_clrflag which = reinforcement_020 }
		command = { type = local_setflag which = reinforcement_050 }
	}
}
