capital = 500


oob = "BRA_1936"
every_core_state = {
	ROOT = {
		add_to_array = { cores_at_game_start = PREV }
	}
}
IF = {
	limit = { has_dlc = "By Blood Alone" }
		set_air_oob = "BRA_1936_air_bba"
	ELSE = {
		set_air_oob = "BRA_1936_air_legacy"
		set_technology = {
			early_fighter = 1
			CAS1 = 1
		}
	}
}
###############################################################################
# ToA
###############################################################################
IF = {
	limit = {
		has_dlc = "Trial of Allegiance"
	}
	set_country_flag = BRA_toa_DLC


	add_ideas = {
		SMB_MTG_naval_arms_race_legacy
	}

	add_ideas = BRA_separatism_idea

	every_owned_state = {
		limit = {
			OR = {
				has_state_category = wasteland
				has_state_category = pastoral
				has_state_category = rural
				#TODO_JUNO: Check states below are correct after map changes implemented
				state = 498
				state = 499
			}
			NOT = {
				state = 961
				state = 962
				state = 963
				state = 964
				state = 965
				state = 966
				state = 967
				state = 968
				state = 496
			}
		}

		# Neglected State Modifier
		set_variable = { BRA_state_development_production_speed = -0.4 }
		set_variable = { BRA_state_development_local_building_slots_factor = -0.4 }
		set_variable = { BRA_state_development_local_factories = -0.4 }
		set_variable = { BRA_state_development_state_resources_factor = -0.4 }

		add_dynamic_modifier = {
			modifier = BRA_neglected_state_dynamic_modifier
		}
	}

	every_owned_state = {
		limit = {
			OR = {
				state = 498
				state = 499
				state = 935
				state = 936
				state = 937
			}
		}
		add_dynamic_modifier = {
			modifier = BRA_cangaceiro_state
		}
	}

	JUNO_set_shared_military_branch_defaults = yes

	# Undiversified Economy Modifier
	set_variable = { BRA_economy_production_efficiency_gain_factor = -0.2 }
	set_variable = { BRA_economy_production_max_efficiency_factor = -0.2 }
	set_variable = { BRA_economy_industrial_capacity_factor = -0.2 }
	
	set_variable = { BRA_weak_government_stability_factor = -0.15 }
	set_variable = { BRA_weak_government_pp_factor = -0.2 }
	set_variable = { BRA_weak_government_neutrality_factor = 0.02 }
	set_variable = { BRA_weak_government_command_power_factor = -0.4}

	set_variable = { BRA_coup_stability_factor = -0.05 }
	set_variable = { BRA_coup_communism_factor = 0.05 }
	set_variable = { BRA_coup_democratic_factor = 0 }
	set_variable = { BRA_coup_fascism_factor = 0 }
	set_variable = { BRA_coup_neutrality_factor = 0 }

	# Estado Novo Modifier
	set_variable = { BRA_estado_novo_stability_factor = 0.1 }
	set_variable = { BRA_estado_novo_fascism_factor = 0 }
	set_variable = { BRA_estado_novo_communism_factor = 0 }
	set_variable = { BRA_estado_novo_democratic_factor = 0 }
	set_variable = { BRA_estado_novo_fascism_factor = 0 }
	set_variable = { BRA_estado_novo_neutrality_factor = 0.2 }
	set_variable = { BRA_estado_novo_production_speed_buildings_factor = 0 }
	set_variable = { BRA_estado_novo_war_support_factor = 0 }
	set_variable = { BRA_estado_novo_recruitable_population_factor = 0 }
	set_variable = { BRA_estado_novo_consumer_goods_factor = 0 }
	set_variable = { BRA_estado_novo_political_power_factor = 0 }
	set_variable = { BRA_estado_novo_production_factory_max_efficiency_factor = 0 }
	set_variable = { BRA_estado_novo_industrial_capacity_factory = 0 }
	set_variable = { BRA_estado_novo_industrial_capacity_dockyard = 0 }
	set_variable = { BRA_estado_novo_production_speed_arms_factory_factor = 0 }
	set_variable = { BRA_estado_novo_production_speed_dockyard_factor = 0 }
	set_variable = { BRA_estado_novo_production_speed_industrial_complex_factor = 0 }

	# Estado Moderno Modifier
	set_variable = { BRA_estado_moderno_stability_factor = 0 }
	set_variable = { BRA_estado_moderno_neutrality_factor = 0 }
	set_variable = { BRA_estado_moderno_communism_factor = 0 }
	set_variable = { BRA_estado_moderno_democratic_factor = 0 }
	set_variable = { BRA_estado_moderno_fascism_factor = 0.2 }
	set_variable = { BRA_estado_moderno_production_speed_buildings_factor = 0 }
	set_variable = { BRA_estado_moderno_war_support_factor = 0 }
	set_variable = { BRA_estado_moderno_recruitable_population_factor = 0 }
	set_variable = { BRA_estado_moderno_consumer_goods_factor = 0 }
	set_variable = { BRA_estado_moderno_political_power_factor = 0 }
	set_variable = { BRA_estado_moderno_production_factory_max_efficiency_factor = 0 }
	set_variable = { BRA_estado_moderno_industrial_capacity_factory = 0 }
	set_variable = { BRA_estado_moderno_industrial_capacity_dockyard = 0 }
	set_variable = { BRA_estado_moderno_production_speed_arms_factory_factor = 0 }
	set_variable = { BRA_estado_moderno_production_speed_dockyard_factor = 0 }
	set_variable = { BRA_estado_moderno_production_speed_industrial_complex_factor = 0 }

	add_dynamic_modifier = { modifier = BRA_undiversified_economy_modifier }
	add_dynamic_modifier = { modifier = BRA_weak_government }
	add_dynamic_modifier = { modifier = BRA_aftermath_of_the_coup }

	set_politics = {
		ruling_party = democratic
		last_election = "1934.7.17"
		election_frequency = 48
		elections_allowed = yes
	}

	set_popularities = {
		democratic = 50
		neutrality = 25
		fascism = 15
		communism = 10
	}

	set_party_name = {
		ideology = neutrality
		name = BRA_military_party
		long_name = BRA_military_party_long
	}

	set_party_name = {
		ideology = democratic
		name = BRA_provisional_government
		long_name = BRA_provisional_government_long
	}

	country_event = {
		id = JUNO_brazil_events.153
		days = 30
		random_days = 15
	}
	#Political

	#Army

	#Navy

	#Cangaco


}
IF = {
	limit = {
		NOT = {
			has_dlc = "Trial of Allegiance"
		}
	}
	set_politics = {
		ruling_party = democratic
		last_election = "1934.7.17"
		election_frequency = 48
		elections_allowed = yes
	}
	set_popularities = {
		democratic = 50
		neutrality = 25
		fascism = 15
		communism = 10
	}
}
###############################################################################

# Starting tech
set_technology = {
	infantry_weapons = 1
	tech_support = 1		
	tech_engineers = 1
	tech_trucks = 1
	gw_artillery = 1
	interwar_antiair = 1
	basic_train = 1	
}

IF = {
	limit = {
		has_dlc = "No Step Back"
	}
	set_technology = {
		gwtank_chassis = 1
	}
}
IF = {
	limit = {
		NOT = { has_dlc = "No Step Back" }
	}
	set_technology = {
		gwtank = 1
	}
}
IF = {
	limit = {
		NOT = { has_dlc = "Man the Guns"}
	}
	set_technology = {
		early_submarine = 1
		early_destroyer = 1
		early_light_cruiser = 1
		early_heavy_cruiser = 1
		early_battleship = 1
		transport = 1
	}
	set_naval_oob = "BRA_1936_naval_legacy"
}
IF = {
	limit = { has_dlc = "Man the Guns"}
	set_technology = {
		basic_naval_mines = 1
		submarine_mine_laying = 1
		early_ship_hull_submarine = 1
		basic_ship_hull_submarine = 1
		early_ship_hull_light = 1
		early_ship_hull_cruiser = 1
		early_ship_hull_heavy = 1
		basic_battery = 1
		basic_torpedo = 1
		mtg_transport = 1
	}
	set_naval_oob = "BRA_1936_naval"	
}

set_country_flag = monroe_doctrine

1939.1.1 = {

	add_political_power = 1198
	add_command_power = 100
	
	#Setting up which focuses are to be coplete upon start
	IF = {
		limit = {
			has_dlc = "Trial of Allegiance"
		}

		complete_national_focus = BRA_tribunal_de_seguranca_nacional
		complete_national_focus = BRA_coffee_crisis_aftermath
		complete_national_focus = BRA_ensure_continued_military_support #35
		complete_national_focus = BRA_work_with_the_integralists #35
		complete_national_focus = SMB_army #35
		complete_national_focus = SMB_navy #35
		complete_national_focus = BRA_desenvolvimentismo
		complete_national_focus = BRA_cohen_plan
		complete_national_focus = BRA_estado_novo #35
		complete_national_focus = BRA_promote_resource_extraction
		complete_national_focus = BRA_the_polaca
		complete_national_focus = BRA_stimulate_the_civilian_economy
		complete_national_focus = BRA_radio_nacional
		complete_national_focus = BRA_deal_with_the_cangaceiro
		complete_national_focus = BRA_establish_psad
		complete_national_focus = BRA_autarky 
		complete_national_focus = BRA_departamendo_de_propaganda
		complete_national_focus = BRA_tech_slot_1

		ELSE = {
			#generic focuses
			complete_national_focus = army_effort
			complete_national_focus = equipment_effort
			complete_national_focus = motorization_effort
			complete_national_focus = aviation_effort
			complete_national_focus = naval_effort
			complete_national_focus = large_navy
			complete_national_focus = industrial_effort
			complete_national_focus = construction_effort
			complete_national_focus = production_effort
		}
	}

# no need to manually add in ideas and modifiers, I have tried and it is not needed, in fact, adding them in does nothing and adding to variables adds double. I write this here to serve as a note to future me, and other rookie CDs, it is not needed. You need not do it. The ideas, modifiers and such are set automatically.
	
	oob = "BRA_1939"
	if = {
		limit = { has_dlc = "By Blood Alone" }
			set_air_oob = "BRA_1939_air_bba"
		else = {
			set_air_oob = "BRA_1939_air_legacy"
		}
	}
	set_technology = {
		interwar_artillery = 1
		infantry_weapons1 = 1
		infantry_weapons2 = 1
		support_weapons = 1
		

		#doctrines
		air_superiority = 1
		grand_battle_plan = 1
		trench_warfare = 1
		fleet_in_being = 1
		battlefleet_concentration = 1
		convoy_sailing = 1


		#electronics
		electronic_mechanical_engineering = 1
		radio = 1
		mechanical_computing = 1
		computing_machine = 1

		#industry
		basic_machine_tools = 1
		improved_machine_tools = 1
		advanced_machine_tools = 1
		synth_oil_experiments = 1
		fuel_silos = 1
		oil_processing = 1
		improved_oil_processing = 1
		construction1 = 1
		construction2 = 1
		dispersed_industry = 1
		dispersed_industry2 = 1
	}
	complete_special_project = {
		project = sp:sp_air_radar
	}
	IF = {
		limit = { NOT = { has_dlc = "Man the Guns" } }
		set_technology = {
			basic_submarine = 1
			basic_destroyer = 1
		}
		set_naval_oob = "BRA_1939_naval_legacy"
	}
	IF = {
		limit = { has_dlc = "Man the Guns" }
		set_technology = {
			basic_ship_hull_light = 1
		}
		set_naval_oob = "BRA_1939_naval"
	}
}

set_convoys = 40

1939.1.1 = {
	set_politics = {
		ruling_party = neutrality
		last_election = "1934.7.17"
		election_frequency = 48
		elections_allowed = no
	}
	set_popularities = {
		neutrality = 100
	}
}

IF = {
	limit = {
		has_dlc = "Man the Guns"
	}
	create_equipment_variant = {
		name = "Minas Geras Class"
		type = ship_hull_heavy_1
		name_group = BRA_BB_HISTORICAL
		parent_version = 0
		modules = {
			fixed_ship_battery_slot = ship_heavy_battery_1
			fixed_ship_anti_air_slot = empty
			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 = empty
			mid_1_custom_slot = ship_secondaries_1
			mid_2_custom_slot = ship_secondaries_1
			rear_1_custom_slot = ship_heavy_battery_1
		}
	}
	create_equipment_variant = {
		name = "Bahia Class"
		type = ship_hull_cruiser_1
		name_group = BRA_CL_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 = cruiser_ship_engine_1
			mid_1_custom_slot = empty
			mid_2_custom_slot = ship_light_battery_1
			rear_1_custom_slot = empty
		}
	}
	create_equipment_variant = {
		name = "Para Class"
		type = ship_hull_light_1
		name_group = BRA_DD_HISTORICAL
		parent_version = 0
		modules = {
			fixed_ship_battery_slot = ship_light_battery_1
			fixed_ship_anti_air_slot = empty
			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 = empty
			rear_1_custom_slot = empty
		}
		obsolete = yes
	}
	create_equipment_variant = {
		name = "Humaytá Class"
		type = ship_hull_submarine_2
		name_group = BRA_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 = ship_mine_layer_sub
		}
	}
}

# 1939 Start #
1939.1.1 = {
	IF = {
		limit = {
			has_dlc = "Man the Guns"
		}
		create_equipment_variant = {
			name = "Tupi Class"
			type = ship_hull_submarine_2
			name_group = BRA_SS_HISTORICAL
			parent_version = 0
			modules = {
				fixed_ship_torpedo_slot = ship_torpedo_sub_1
				fixed_ship_engine_slot = sub_ship_engine_1
				rear_1_custom_slot = empty
			}
		}
	}
}