set_country_flag = polit_nato_ally
capital = 41
add_ideas = disarmed_nation 
add_ideas = CRI_first_world_country
load_focus_tree = generic_focus
oob = "SPR_1936"
if = {
	limit = { has_dlc = "Man the Guns" }
		set_naval_oob = "SPR_1936_naval_mtg"
	else = {
		set_naval_oob = "SPR_1936_naval_legacy"
	}
}
if = {
	limit = { has_dlc = "By Blood Alone" }
		set_air_oob = "SPR_1936_air_bba"
	else = {
		set_air_oob = "SPR_1936_air_legacy"
	}
}


if = {
	limit = {
		has_dlc = "Man the Guns"
	}
	set_technology = {
		basic_naval_mines = 1
		submarine_mine_laying = 1
		basic_torpedo = 1
		basic_battery = 1
		basic_light_battery = 1
		basic_heavy_battery = 1
		basic_medium_battery = 1
		improved_ship_torpedo_launcher = 1
		early_ship_hull_submarine = 1
		basic_ship_hull_submarine = 1
		early_ship_hull_light = 1
		early_ship_hull_cruiser = 1
		basic_ship_hull_cruiser = 1
		early_ship_hull_heavy = 1
		basic_ship_hull_heavy = 1
		early_ship_hull_carrier = 1
		basic_ship_hull_carrier = 1
		mtg_transport = 1
		coastal_defense_ships = 1
		basic_depth_charges = 1
		basic_cruiser_armor_scheme = 1
		cruiser_submarines = 1
		basic_dp_light_battery = 1
	}

}
if = {
	limit = { not = { has_dlc = "Man the Guns" } }
	set_technology = {
		early_submarine = 1
		basic_submarine = 1
		early_destroyer = 1
		early_light_cruiser = 1
		basic_light_cruiser = 1
		early_heavy_cruiser = 1
		basic_heavy_cruiser = 1
		early_battleship = 1
		basic_battleship = 1
		early_battlecruiser = 1
		early_carrier = 1
		basic_carrier = 1
		transport = 1
	}

}

if = {
	limit = {
		NOT = {
			has_dlc = "La Resistance"
		}
	}
	recruit_character = SPR_niceto_alcala_zamora
	recruit_character = SPR_jose_diaz
	recruit_character = SPR_alejandro_lerroux
	recruit_character = SPA_francisco_franco
	recruit_character = SPR_jose_asensio_torrado
	recruit_character = SPA_ricardo_rada
	recruit_character = SPR_diego_hidalgo_duran
	recruit_character = SPA_luis_carrero_blanco
	recruit_character = SPA_joaquin_garcia_morato
	recruit_character = SPR_andres_saborit_colomer
	recruit_character = SPA_miguel_cabanellas
	recruit_character = SPR_jose_miaja
	recruit_character = SPA_juan_yague
	recruit_character = SPA_emilio_esteban_infantes
	recruit_character = SPA_salvador_moreno_fernandez
	recruit_character = SPR_vicente_rojo_lluch
	recruit_character = SPR_miguel_buiza_fernandez_palacios
	recruit_character = SPA_jose_enrique_varela
	recruit_character = SPA_fransisco_moreno_fernandez
	recruit_character = SPR_luis_gonzalez_de_ubieta
	recruit_character = SPA_emilio_herrera
	recruit_character = SPR_carlos_masquelet_lacaci
	recruit_character = SPR_indalecio_prieto_tuero
	recruit_character = SPA_angel_salas_larrazabal
	recruit_character = SPA_agustin_munoz_grandes
	recruit_character = SPR_ignacio_hidalgo_de_cisneros
	recruit_character = SPR_andres_garcia_la_calle
	recruit_character = SPA_emilio_mola
	recruit_character = SPA_alfredo_kindelan_duany
	recruit_character = SPR_antonio_azarola_y_gresillon
	recruit_character = SPR_nicolas_molero
	recruit_character = SPR_dolores_ibarruri
	recruit_character = SPR_diego_martinez_barrio
	recruit_character = SPR_augusto_barcia_trelles
	recruit_character = SPR_francisco_largo_caballero

	set_popularities = {
		democratic = 47
		neutrality = 46
		communism = 7
	}
}

if = {
	limit = {
		has_dlc = "Battle for the Bosporus"
	}
	set_technology = { camelry = 1 }
}

if = {
	limit = {
		has_dlc = "La Resistance"
	}
	every_owned_state = {
		limit = {
			NOT = {
				state = 177
				state = 178
				state = 290
				state = 699
				state = 783
				state = 297
			}
		}
		set_variable = { var = SPA_garrison_control value = 1 }
		SPA_garrison_control_cost_calculation = yes
	}
	set_popularities = {
		democratic = 41
		fascism = 37
		communism = 7
		neutrality = 15
	}
	create_dynamic_country = {
	    original_tag = SPR
	    set_country_flag = SPR_nationalist_spain_flag
		set_politics = {
			ruling_party = neutrality
		}
		set_cosmetic_tag = SPR_nationalist_spain
		set_research_slots = 3
	    reserve_dynamic_country = yes
	}
	create_dynamic_country = {
	    original_tag = SPR
	    set_country_flag = SPR_carlist_spain_flag
	    set_politics = {
			ruling_party = neutrality
		}
		set_cosmetic_tag = SPR_carlist_spain
		set_research_slots = 3
	    reserve_dynamic_country = yes
	}
	create_dynamic_country = {
	    original_tag = SPR
	    set_country_flag = SPR_anarchist_spain_flag
	    set_politics = {
			ruling_party = neutrality
		}
		set_cosmetic_tag = SPR_anarchist_spain
		set_research_slots = 3
	    reserve_dynamic_country = yes
	}
	SPR = {
		set_variable = { var = spa_civil_war_divisions_counter_var value = 17 }
		set_variable = { var = spr_civil_war_divisions_counter_var value = 66 }
	}
	for_each_scope_loop = {
	    array = core_states
	    
	    set_state_flag = SPR_original_core
	}
	add_ideas = {
		#SPA_carlism_1
		#SPR_military_disloyalty
		#SPR_political_violence
		#SPR_national_strikes_3
	}
	recruit_character = SPR_niceto_alcala_zamora
	recruit_character = SPR_jose_diaz
	recruit_character = SPA_jose_antonio_primo_de_rivera
	recruit_character = SPR_manuel_fal_conde
	recruit_character = SPR_vicente_rojo_lluch
	recruit_character = SPR_jose_miaja
	recruit_character = SPR_jose_asensio_torrado
	recruit_character = SPR_valentin_gonzalez
	recruit_character = SPR_enrique_lister
	recruit_character = SPR_juan_modesto
	recruit_character = SPR_antonio_cordon_garcia
	recruit_character = SPR_janos_galicz
	recruit_character = SPA_francisco_franco
	recruit_character = SPR_mohamed_meziane
	recruit_character = SPR_gonzalo_queipo_de_llano
	recruit_character = SPA_emilio_mola
	recruit_character = SPA_juan_yague
	recruit_character = SPA_agustin_munoz_grandes
	recruit_character = SPA_jose_enrique_varela
	recruit_character = SPA_miguel_cabanellas
	recruit_character = SPR_jose_millan_astray
	recruit_character = SPR_miguel_buiza_fernandez_palacios
	recruit_character = SPA_luis_carrero_blanco
	recruit_character = SPA_rafael_garcia_valino
	recruit_character = SPA_heli_rolando_de_tella
	recruit_character = SPA_miguel_ponte
	recruit_character = SPA_joaquin_garcia_morato
	recruit_character = SPA_juan_vigon_suero_diaz
	recruit_character = SPA_wilhelm_ritter_von_thoma
	recruit_character = SPA_enrique_canovas_lacruz
	recruit_character = SPA_ricardo_rada
	recruit_character = SPR_nicolas_molero
	recruit_character = SPR_felipe_diaz_sandino
	recruit_character = SPR_andres_nin
	recruit_character = SPR_council_of_theorists
	recruit_character = SPR_domenec_batet
	recruit_character = SPR_etelvino_vega
	recruit_character = SPR_mate_zalka
	recruit_character = SPR_defensive_military_council
	recruit_character = SPR_offensive_military_council
	recruit_character = SPR_organizational_military_council
	recruit_character = SPR_ignacio_hidalgo_de_cisneros
	recruit_character = SPR_andres_garcia_la_calle
	recruit_character = SPR_alberto_bayo
	recruit_character = SPR_air_safety_aviation_council
	recruit_character = SPR_all_weather_aviation_council
	recruit_character = SPR_luis_gonzalez_de_ubieta
	recruit_character = SPR_joakin_egia_unzueta
	recruit_character = SPR_commerce_raiding_naval_council
	recruit_character = SPR_reform_naval_council
	recruit_character = SPR_toribio_martinez_cabrera
	recruit_character = SPR_francisco_ciutat_de_miguel
	recruit_character = SPR_antonio_ortega_gutierrez
	recruit_character = SPR_antonio_azarola_y_gresillon
	recruit_character = SPR_jose_rovira
	recruit_character = SPR_carmel_rosa_baserba
	recruit_character = SPR_wilhelm_zaisser
	recruit_character = SPR_antonio_escobar_huerta
	recruit_character = SPR_infantry_military_council
	recruit_character = SPR_army_regrouping_military_council
	recruit_character = SPR_concealment_military_council
	recruit_character = SPR_naval_strike_aviation_council
	recruit_character = SPR_close_air_support_aviation_council
	recruit_character = SPR_logistics_naval_council
	recruit_character = SPR_anti_submarine_naval_council
	recruit_character = SPR_juan_negrin
	recruit_character = SPR_juan_lopez_sanchez
	recruit_character = SPR_juan_garcia_oliver
	recruit_character = SPR_federica_montseny
	recruit_character = SPR_juan_andrade
	recruit_character = SPR_antonia_adroher_i_pascual
	recruit_character = SPR_jesus_hernandez_tomas
	recruit_character = SPR_alexander_orlov
	recruit_character = SPR_indalecio_prieto
	recruit_character = SPR_dolores_ibarruri
	recruit_character = SPR_diego_martinez_barrio
	recruit_character = SPR_augusto_barcia_trelles
	recruit_character = SPR_francisco_largo_caballero
	recruit_character = SPA_luis_valdes_cavanillas
	recruit_character = SPA_tomas_garciano_goni
	recruit_character = SPA_fidel_davila_arrondo
	recruit_character = SPA_jose_antonio_giron
	recruit_character = SPA_manuel_hedilla
	recruit_character = SPA_raimundo_fernandez_cuesta
	recruit_character = SPA_tomas_dominguez_arevalo
	recruit_character = SPA_diego_hidalgo_y_duran
	recruit_character = SPA_ramon_serrano_suner
	recruit_character = SPA_luis_hernando_de_larramendi
	recruit_character = SPA_martin_de_riquer
	recruit_character = SPA_mauricio_de_sivatte
	165 = {
		add_dynamic_modifier = { modifier = autonomous_state }
	}
	171 = {
		add_dynamic_modifier = { modifier = autonomous_state }
	}
	792 = {
		add_dynamic_modifier = { modifier = autonomous_state }
	}

	SPR_enrique_lister = {
		set_character_flag = SPR_do_not_align_me_flag
	}
	SPR_valentin_gonzalez = {
		set_character_flag = SPR_do_not_align_me_flag
	}
}

set_research_slots = 3

set_technology = {
	infantry_weapons = 1
	infantry_weapons1 = 1
	tech_recon = 1
	tech_support = 1		
	tech_engineers = 1
	tech_mountaineers = 1
	tech_trucks = 1
	gw_artillery = 1
	interwar_antiair = 1
	basic_train = 1
}
if = {
	limit = {
		NOT = { has_dlc = "By Blood Alone" }
	}
	set_technology = {
		early_fighter = 1
		early_bomber = 1
		naval_bomber1 = 1
	}
}
if = {
	limit = { not = { has_dlc = "Man the Guns" } }
	set_technology = {
		early_submarine = 1
		early_destroyer = 1
		basic_destroyer = 1
		early_light_cruiser = 1
		early_heavy_cruiser = 1
		basic_heavy_cruiser = 1
		early_battleship = 1
		transport = 1
	}
}
if = {
	limit = { has_dlc = "Man the Guns" }
	set_technology = {
		basic_naval_mines = 1
		submarine_mine_laying = 1
		early_ship_hull_light = 1
		basic_ship_hull_light = 1
		early_ship_hull_submarine = 1
		basic_ship_hull_submarine = 1
		early_ship_hull_cruiser = 1
		basic_ship_hull_cruiser = 1
		early_ship_hull_heavy = 1
		basic_battery = 1
		basic_medium_battery = 1
		basic_torpedo = 1
		basic_depth_charges = 1
		mtg_transport = 1
	}
}

set_politics = {
	ruling_party = neutrality
	last_election = "1933.2.16"
	election_frequency = 36
	elections_allowed = yes
}

set_convoys = 150
set_stability = 0.5


if = {
	limit = {
		has_dlc = "No Step Back"
	}
	set_technology = {
		gwtank_chassis = 1
		basic_light_tank_chassis = 1
	}
}
	if = {
		limit = { not = { has_dlc = "Man the Guns" } }
		set_technology = {
		}
	}
	if = {
		limit = { has_dlc = "Man the Guns" }
		set_technology = {
			basic_light_battery = 1
		}
	}

	set_global_flag = spanish_civil_war
	set_global_flag = scw_over
	#add_timed_idea = { idea = SPA_recovering_from_civil_war days = 1095 }
}

if = {
	limit = {
		NOT = { has_dlc = "La Resistance" }
	}
}

if = {
	limit = {
		has_dlc = "La Resistance"
	}
}

### VARIANTS ###
# 1936 Start #
if = {
	limit = { not = { has_dlc = "Man the Guns" } }
	### Ship Variants ###
	create_equipment_variant = {
		name = "C Class"
		type = submarine_1
		upgrades = {
			ship_reliability_upgrade = 1
			sub_engine_upgrade = 1
			sub_stealth_upgrade = 1
			sub_torpedo_upgrade = 1
		}
	}
	create_equipment_variant = {
		name = "Principe Alfonso Class"
		type = light_cruiser_1
		upgrades = {
			ship_reliability_upgrade = 1
			ship_engine_upgrade = 1
			ship_gun_upgrade = 1
			ship_anti_air_upgrade = 1
		}
	}
}
if = {
	limit = { has_dlc = "Man the Guns" }
	# Submarines #
	create_equipment_variant = {
		name = "B Class"				
		type = ship_hull_submarine_1
		parent_version = 0
		name_group = SPR_SS_HISTORICAL
		modules = {
			fixed_ship_torpedo_slot = ship_torpedo_sub_1
			fixed_ship_engine_slot = sub_ship_engine_1
			rear_1_custom_slot = empty
		}
		obsolete = yes
	}
	create_equipment_variant = {
		name = "C Class"				
		type = ship_hull_submarine_2
		name_group = SPR_SS_HISTORICAL
		parent_version = 0
		modules = {
			fixed_ship_torpedo_slot = ship_torpedo_sub_1
			fixed_ship_engine_slot = sub_ship_engine_2
			rear_1_custom_slot = empty
		}
	}
	# Destroyers #
	create_equipment_variant = {
		name = "Alsedo Class"				
		type = ship_hull_light_1
		name_group = SPR_DD_HISTORICAL
		parent_version = 0
		modules = {
			fixed_ship_battery_slot = ship_light_battery_1
			fixed_ship_anti_air_slot = ship_anti_air_1
			fixed_ship_fire_control_system_slot = ship_fire_control_system_0
			fixed_ship_radar_slot = empty
			fixed_ship_engine_slot = light_ship_engine_1
			fixed_ship_torpedo_slot = ship_torpedo_1
			mid_1_custom_slot = ship_mine_layer_1
			rear_1_custom_slot = ship_depth_charge_1
		}
		obsolete = yes
	}
	create_equipment_variant = {
		name = "Churucca Class"	
		type = ship_hull_light_2
		name_group = SPR_DD_HISTORICAL
		parent_version = 0
		modules = {
			fixed_ship_battery_slot = ship_light_battery_1
			fixed_ship_anti_air_slot = ship_anti_air_1
			fixed_ship_fire_control_system_slot = ship_fire_control_system_0
			fixed_ship_radar_slot = empty
			fixed_ship_engine_slot = light_ship_engine_2
			fixed_ship_torpedo_slot = ship_torpedo_1
			mid_1_custom_slot = empty
			rear_1_custom_slot = ship_depth_charge_1
		}
	}
	create_equipment_variant = {
		name = "Jupiter Class"					# minelayers
		type = ship_hull_light_2
		name_group = SPR_DD_HISTORICAL
		parent_version = 0
		modules = {
			fixed_ship_battery_slot = ship_light_battery_1
			fixed_ship_anti_air_slot = ship_anti_air_1
			fixed_ship_fire_control_system_slot = ship_fire_control_system_0
			fixed_ship_radar_slot = empty
			fixed_ship_engine_slot = light_ship_engine_1
			fixed_ship_torpedo_slot = empty
			mid_1_custom_slot = ship_mine_layer_1
			rear_1_custom_slot = ship_depth_charge_1
		}
	}
	# Light Cruisers #
	create_equipment_variant = {
		name = "Republica Class"
		type = ship_hull_cruiser_1
		name_group = SPR_CL_HISTORICAL
		parent_version = 0
		modules = {
			fixed_ship_battery_slot = ship_light_medium_battery_1
			fixed_ship_anti_air_slot = ship_anti_air_1
			fixed_ship_fire_control_system_slot = ship_fire_control_system_0
			fixed_ship_radar_slot = empty
			fixed_ship_engine_slot = cruiser_ship_engine_1
			mid_1_custom_slot = ship_torpedo_1
			mid_2_custom_slot = ship_light_medium_battery_1
			rear_1_custom_slot = empty
		}
		obsolete = yes
	}
	create_equipment_variant = {
		name = "Mendez Nunes Class"
		type = ship_hull_cruiser_1
		name_group = SPR_CL_HISTORICAL
		parent_version = 0
		modules = {
			fixed_ship_battery_slot = ship_light_medium_battery_1
			fixed_ship_anti_air_slot = ship_anti_air_1
			fixed_ship_fire_control_system_slot = ship_fire_control_system_0
			fixed_ship_radar_slot = empty
			fixed_ship_engine_slot = cruiser_ship_engine_1
			fixed_ship_armor_slot = ship_armor_cruiser_1
			mid_1_custom_slot = ship_torpedo_1
			mid_2_custom_slot = ship_torpedo_1
			rear_1_custom_slot = empty
		}
		obsolete = yes
	}
	create_equipment_variant = {
		name = "Principe Alfonso Class"
		type = ship_hull_cruiser_2
		name_group = SPR_CL_HISTORICAL
		parent_version = 0
		modules = {
			fixed_ship_battery_slot = ship_light_medium_battery_1
			fixed_ship_anti_air_slot = ship_anti_air_1
			fixed_ship_fire_control_system_slot = ship_fire_control_system_0
			fixed_ship_radar_slot = empty
			fixed_ship_engine_slot = cruiser_ship_engine_2
			fixed_ship_armor_slot = ship_armor_cruiser_1
			front_1_custom_slot = empty
			mid_1_custom_slot = ship_torpedo_1
			mid_2_custom_slot = ship_torpedo_1
			rear_1_custom_slot = ship_light_medium_battery_1
		}
	}
	# Heavy Cruisers #
	create_equipment_variant = {
		name = "Canarias Class"				
		type = ship_hull_cruiser_2
		name_group = SPR_CA_HISTORICAL
		parent_version = 0
		modules = {
			fixed_ship_battery_slot = ship_medium_battery_2
			fixed_ship_anti_air_slot = ship_anti_air_1
			fixed_ship_fire_control_system_slot = ship_fire_control_system_0
			fixed_ship_radar_slot = empty
			fixed_ship_engine_slot = cruiser_ship_engine_2
			fixed_ship_armor_slot = empty
			mid_1_custom_slot = ship_medium_battery_2
			mid_2_custom_slot = empty
			rear_1_custom_slot = ship_depth_charge_1
		}
	}
	# Battleships #
	create_equipment_variant = {
		name = "Espana Class"	
		type = ship_hull_heavy_1
		name_group = SPR_BB_HISTORICAL
		parent_version = 0
		modules = {
			fixed_ship_battery_slot = ship_heavy_battery_1
			fixed_ship_anti_air_slot = ship_anti_air_1
			fixed_ship_fire_control_system_slot = ship_fire_control_system_0
			fixed_ship_radar_slot = empty
			fixed_ship_engine_slot = heavy_ship_engine_1
			fixed_ship_secondaries_slot = ship_secondaries_1
			fixed_ship_armor_slot = ship_armor_bb_1
			front_1_custom_slot = ship_heavy_battery_1
			mid_1_custom_slot = ship_secondaries_1
			mid_2_custom_slot = ship_secondaries_1
			rear_1_custom_slot = empty
		}
	}
}

add_ideas = CRI_first_world_country
set_convoys = 25