on_actions = {
	#STARTUP DEFINITIONS
	on_startup = {
		effect = {
			#############################################
			###
			### Worker test zone - DOC AT WORK
			###
			#############################################

			if = {
				limit = {
					has_game_rule = {
						rule = burgundy_collapse_status
						option = BURGUNDY_COLLAPSE_ENSURED
					}
				}
				set_global_flag = BURGUNDY_COLLAPSE_ENSURED_GAME_RULE
			}
			else_if = {
				limit = {
					has_game_rule = {
						rule = burgundy_collapse_status
						option = BURGUNDY_COLLAPSE_DISABLED
					}
				}
				set_global_flag = BURGUNDY_COLLAPSE_DISABLED_GAME_RULE
			}

			BRG = {
				country_event = { id = BRG_ai_collapse.100 days = 2920 }

				if = { #Make their Intelligence Agency T H I C C
					limit = { is_ai = yes }

					upgrade_intelligence_agency = upgrade_economy_department
					upgrade_intelligence_agency = upgrade_army_department
					upgrade_intelligence_agency = upgrade_naval_department
					upgrade_intelligence_agency = upgrade_airforce_department
					upgrade_intelligence_agency = upgrade_passive_defense
					upgrade_intelligence_agency = upgrade_passive_defense
					upgrade_intelligence_agency = upgrade_passive_defense
					upgrade_intelligence_agency = upgrade_passive_defense
					upgrade_intelligence_agency = upgrade_anti_guerrilla_activities
					upgrade_intelligence_agency = upgrade_anti_guerrilla_activities
					upgrade_intelligence_agency = upgrade_industrial_espionage
					upgrade_intelligence_agency = upgrade_wiretapping
					upgrade_intelligence_agency = upgrade_agency_infiltration
					upgrade_intelligence_agency = upgrade_surveillance_aircraft
					upgrade_intelligence_agency = upgrade_computer_hacking
					upgrade_intelligence_agency = upgrade_computer_hacking
					upgrade_intelligence_agency = upgrade_global_training_centers
					upgrade_intelligence_agency = upgrade_global_training_centers
					upgrade_intelligence_agency = upgrade_special_forces_training
					upgrade_intelligence_agency = upgrade_special_forces_training
					upgrade_intelligence_agency = upgrade_special_forces_training
					upgrade_intelligence_agency = upgrade_enhanced_interrogation_methods
					upgrade_intelligence_agency = upgrade_diplomatic_training
					upgrade_intelligence_agency = upgrade_psychological_warfare
					upgrade_intelligence_agency = upgrade_modernize_department
					upgrade_intelligence_agency = upgrade_cryptographic_engineering
					upgrade_intelligence_agency = upgrade_cryptographic_engineering
					upgrade_intelligence_agency = upgrade_cryptographic_engineering
					upgrade_intelligence_agency = upgrade_government_developed_ciphers
					upgrade_intelligence_agency = upgrade_government_developed_ciphers
					upgrade_intelligence_agency = upgrade_government_developed_ciphers
					upgrade_intelligence_agency = upgrade_public_key_cryptography
					upgrade_intelligence_agency = upgrade_public_key_cryptography
					upgrade_intelligence_agency = upgrade_computerized_cracking
				}

				#######################################################################
				############## ECON
				#######################################################################

				set_variable = { BRG_Econ_Dynamic_Mod_Construction_Speed = 0.1 }
				set_variable = { BRG_Econ_Dynamic_Mod_Factory_Output = 0.1 }
				set_variable = { BRG_Econ_Dynamic_Mod_Factory_Retention = 0.1 }
				set_variable = { BRG_Econ_Dynamic_Mod_Stability = -0.1 }
				set_variable = { BRG_Econ_Dynamic_Mod_PP = -0.1 }
				set_variable = { BRG_Econ_Dynamic_Mod_Free_PUS = 0 }
				set_variable = { BRG_Hidden_Econ_Dynamic_Mod_PUS = 0 }
				set_variable = { BRG_Progress_Bar_Variable = 0 }

				#######################################################################
				############## Political
				#######################################################################

				set_variable = { BRG_Gathered_Intelligence = 60 }
				set_variable = { BRG_Used_Intel_In_Operation = 0 }
				set_variable = { BRG_Operation_Sucsess_Prediction = 30 }
				set_variable = { BRG_Number_Times_Put_Intel_Into_Operation = 1 }
				set_variable = { BRG_Operation_Failure_Prediction = 0 }
				set_variable = { BRG_Monthly_Intel_Gain = 7 }
				set_variable = { BRG_Bonus_Intel_Cost = 0 }
				set_variable = { BRG_Degrelle_Sus = 40 }
				set_variable = { BRG_Gathered_Evidence_On_Degrelle = 0 }
				set_variable = { BRG_Large_Evidence = 0 }
				set_variable = { BRG_Evidence_On_Walloon = 0 }
				set_variable = { BRG_Charla_Sus = 30 }
				set_variable = { BRG_RPY_Sus = 25 }
				set_variable = { BRG_WLN_Sus = 35 }
				set_variable = { BRG_Charla_Sus_Gain = 0 }
				set_variable = { BRG_Lange_Sus = 0 }
				set_variable = { BRG_Lange_Sus_Gain = 0 }
				set_variable = { BRG_Domestic_GUI_Display_Info_Variable = 0 }

				#######################################################################
				############## EDUCATION
				#######################################################################

				set_variable = { BRG_National_Indoctrination = 0 }

				#######################################################################
				############## FAMINE
				#######################################################################

				set_variable = { BRG_food_income_base = 1 } #This shoulld never be directly added to, only altered by ideas
				set_variable = { BRG_food_consumption_base = 1 } #This shoulld never be directly added to, only altered by ideas
				set_variable = { BRG_National_Food_Reserve = 450000 }
				set_variable = { BRG_food_capacity = 450000 }
				set_variable = { BRG_last_months_food_balance = 0 }

				set_variable = { 6.BRG_state_food_production = 116250 } # Flanders
				set_variable = { 17.BRG_state_food_production = 47250 } #Freigafschaft
 				set_variable = { 18.BRG_state_food_production = 20500 } # Kampen
				set_variable = { 29.BRG_state_food_production = 60000 } # Kalen
				set_variable = { 34.BRG_state_food_production = 84000 } # Wallonien
				set_variable = { 1733.BRG_state_food_production = 0 }
				set_variable = { 1734.BRG_state_food_production = 0 }

				############ French States
				set_variable = { 15.BRG_state_food_production = 0 } # Normandie, produces nothing to represent the total focus on Rodomo
				set_variable = { 16.BRG_state_food_production = 0 } # Grob paris, no food production it is litteraly just a city
				set_variable = { 788.BRG_state_food_production = 135000 } # Meau
				set_variable = { 1625.BRG_state_food_production = 20500 } # Reimen
				set_variable = { 1626.BRG_state_food_production = 80000 } # Pickardien
				set_variable = { 1635.BRG_state_food_production = 80000 } # Burgund

				#######################################################################
				############## Skilled Worker State Level Variables, starting states
				#######################################################################

				set_variable = { BRG_Skilled_Worker_National_Pop_Reserve = 25000 }
				set_variable = { BRG_Skilled_Worker_National_Pop_Change_Value = 1500 }

				set_variable = { 6.BRG_Skilled_Worker_Pop = 45500 } # Flanders
				set_variable = { 17.BRG_Skilled_Worker_Pop = 18000 } #Freigafschaft
 				set_variable = { 18.BRG_Skilled_Worker_Pop = 11250 } # Kampen
				set_variable = { 29.BRG_Skilled_Worker_Pop = 20000 } # Kalen
				set_variable = { 34.BRG_Skilled_Worker_Pop = 48000 } # Wallonien
				set_variable = { 1733.BRG_Skilled_Worker_Pop = 0 }
				set_variable = { 1734.BRG_Skilled_Worker_Pop = 0 }

				############ French States
				set_variable = { 15.BRG_Skilled_Worker_Pop = 31500 } # Normandie
				set_variable = { 16.BRG_Skilled_Worker_Pop = 90000 } # Grob paris
				set_variable = { 788.BRG_Skilled_Worker_Pop = 37500 } # Meau
				set_variable = { 1625.BRG_Skilled_Worker_Pop = 11250 } # Reimen
				set_variable = { 1626.BRG_Skilled_Worker_Pop = 30000 } # Pickardien
				set_variable = { 1635.BRG_Skilled_Worker_Pop = 24000 } # Burgund

				#######################################################################
				############## COPS POP STUFF
				#######################################################################

				set_variable = { BRG_Cops_National_Reserve = 30000 }
				set_variable = { BRG_Cops_National_Reserve_Change_Value = 1500 }
				set_variable = { BRG_Cops_Monthly_Gain = 1000 }

				set_variable = { BRG_Legion_Disloyaltly_Growth = 0 }
				set_variable = { BRG_Resistance_Growth = 0 }

				set_variable = { 6.BRG_Cops_Pop_State_Counter = 21500 } # Flanders
				set_variable = { 17.BRG_Cops_Pop_State_Counter = 11000 } #Freigafschaft
				set_variable = { 18.BRG_Cops_Pop_State_Counter = 12000 } # Kampen
				set_variable = { 29.BRG_Cops_Pop_State_Counter = 16000 } # Kalen
				set_variable = { 34.BRG_Cops_Pop_State_Counter = 20000 } # Wallonien
				set_variable = { 1733.BRG_Cops_Pop_State_Counter = 1000 }
				set_variable = { 1734.BRG_Cops_Pop_State_Counter = 1000 }

				############ French States
				set_variable = { 16.BRG_Cops_Pop_State_Counter = 50000 } # Grob paris
				set_variable = { 15.BRG_Cops_Pop_State_Counter = 15750 } # Normandie
				set_variable = { 788.BRG_Cops_Pop_State_Counter = 12000 } # Meau
				set_variable = { 1625.BRG_Cops_Pop_State_Counter = 12000 } # Reimen
				set_variable = { 1626.BRG_Cops_Pop_State_Counter = 16000 } # Pickardien
				set_variable = { 1635.BRG_Cops_Pop_State_Counter = 12000 } # Burgund

				###Globalplan supply
				set_variable = { BRG_supplies = 15 }
				set_variable = { BRG_supply_consumption = 3 }
				set_variable = { BRG_gp_months_counter = 0 }
				set_variable = { BRG_progress_towards_next_consumption_increase = 0 }
				set_variable = { BRG_additional_supply_consumption = 0 }
				set_variable = { BRG_gp_activation_cost = 5 }


				#######################################################################
				############## DISPLAY VARIABLES
				#######################################################################

				set_variable = { 6.BRG_Pop_Legion_Gain_Tooltip_Variable_Display = 0 } # Flanders
				set_variable = { 17.BRG_Pop_Legion_Gain_Tooltip_Variable_Display = 0 } #Freigafschaft
				set_variable = { 18.BRG_Pop_Legion_Gain_Tooltip_Variable_Display = 0 } # Kampen
				set_variable = { 29.BRG_Pop_Legion_Gain_Tooltip_Variable_Display = 0 } # Kalen
				set_variable = { 34.BRG_Pop_Legion_Gain_Tooltip_Variable_Display = 0 } # Wallonien

				############ French States
				set_variable = { 15.BRG_Pop_Legion_Gain_Tooltip_Variable_Display = 0 } # Normandie
				set_variable = { 16.BRG_Pop_Legion_Gain_Tooltip_Variable_Display = 0 } # Grob paris
				set_variable = { 788.BRG_Pop_Legion_Gain_Tooltip_Variable_Display = 0 } # Meau
				set_variable = { 1625.BRG_Pop_Legion_Gain_Tooltip_Variable_Display = 0 } # Reimen
				set_variable = { 1626.BRG_Pop_Legion_Gain_Tooltip_Variable_Display = 0 } # Pickardien
				set_variable = { 1635.BRG_Pop_Legion_Gain_Tooltip_Variable_Display = 0 } # Burgund
				set_variable = { 1733.BRG_Pop_Legion_Gain_Tooltip_Variable_Display = 0 }
				set_variable = { 1734.BRG_Pop_Legion_Gain_Tooltip_Variable_Display = 0 }

				############ BURGUNDIAN STATES

				set_variable = { 6.BRG_How_Many_Cops_You_Need_Variable_Display = 0 } # Flanders
				set_variable = { 17.BRG_How_Many_Cops_You_Need_Variable_Display = 0 } #Freigafschaft
				set_variable = { 18.BRG_How_Many_Cops_You_Need_Variable_Display = 0 } # Kampen
				set_variable = { 29.BRG_How_Many_Cops_You_Need_Variable_Display = 0 } # Pickardien
				set_variable = { 34.BRG_How_Many_Cops_You_Need_Variable_Display = 0 } # Wallonien
				set_variable = { 1733.BRG_How_Many_Cops_You_Need_Variable_Display = 0 }
				set_variable = { 1734.BRG_How_Many_Cops_You_Need_Variable_Display = 0 }

				############ French States
				set_variable = { 15.BRG_How_Many_Cops_You_Need_Variable_Display = 0 } # Normandie
				set_variable = { 16.BRG_How_Many_Cops_You_Need_Variable_Display = 0 } # Grob paris
				set_variable = { 788.BRG_How_Many_Cops_You_Need_Variable_Display = 0 } # Meau
				set_variable = { 1625.BRG_How_Many_Cops_You_Need_Variable_Display = 0 } # Reimen
				set_variable = { 1626.BRG_How_Many_Cops_You_Need_Variable_Display = 0 } # Kalen
				set_variable = { 1635.BRG_How_Many_Cops_You_Need_Variable_Display = 0 } # Burgund

				########################################################## END POP WORK


				########################################################
				########### OPERATIONS
				########################################################

				set_variable = { BRG_Operations_Groundwork = 0 }
				set_variable = { BRG_Operations_Monthly_Groundwork_Gain = 3 }
				set_variable = { BRG_Operations_Targeted_Legion_Sus_Monthly_Gain = 3 }
				set_variable = { BRG_Operations_Target_Selector = 0 } ### 1 is Walloon, 2 is Charlemagne, 3 is RPY
				set_variable = { BRG_Operations_Targeted_Legion_Current_Sus = 0 }
				set_variable = { BRG_Operations_Charlemagne_Prep = 0 }
				set_variable = { BRG_Operations_Walloon_Prep = 0 }
				set_variable = { BRG_Operations_RPY_Prep = 0 }


				########################################################## RESISTANCE 

				set_variable = { 15.ResistanceSupport = 0 }
				set_variable = { 16.ResistanceSupport = 0 }

				###TREE UNLOCKS

				country_event = { id = BRG_unlock.2 days = 1103 } #Political 2
				country_event = { id = BRG_unlock.3 days = 2931 } #Political 3
				country_event = { id = BRG_unlock.4 days = 730 } #Infra 1
				country_event = { id = BRG_unlock.5 days = 2559 } #Infrastructure 2 (is is tied to FBW)
				country_event = { id = BRG_unlock.7 days = 1481 } #Education tree
				country_event = { id = BRG_unlock.100 days = 1825 } #Famine Checker


				BRG_Updating_State_Pops_Overlays = yes

				BRG_Monthly_Econ_Update = yes
			}
		}
	}

	on_state_control_changed = {
		effect = {
			if = { #Burgundy wins #NOTE FROM VOLK when peace deal code is made, remove this and instead make the event fire after the peace deal
				limit = { 
					BRG = {
						has_country_flag = BRG_Revolt_Happened
						controls_state = 15
						controls_state = 34
						controls_state = 6
					}
					NOT = {
						country_exists = FLR
						country_exists = PIC
						country_exists = RPY
						country_exists = BEL
					}
				}
				BRG = { country_event = { id = BRG_collapse.102 } }
			}
		}
	}

	on_weekly_BRG = { # Worker Test Zone
		effect = {
			BRG_Updating_State_Pops_Overlays = yes

			#punishment events, moved from triggered events to checks (1check/day/tag to 1/week total)
			if = {	
				limit = {
					NOT = { has_completed_focus = BRG_our_lineage_secured }
					any_owned_state = {
						check_variable = { THIS.HimmlerSupport < 40 }
						check_variable = { THIS.HimmlerSupport < THIS.CharlemagneSupport }
					}
					has_country_flag = BRG_Education_Crisis_Begun
				}
				country_event = { id = BRG_education.5 days = 1 }
			}
			if = {
				limit = {
					NOT = { has_completed_focus = BRG_our_lineage_secured }
					any_owned_state = {
						check_variable = { THIS.HimmlerSupport < 30 }
						check_variable = { THIS.HimmlerSupport < THIS.CharlemagneSupport }
					}
					has_country_flag = BRG_Education_Crisis_Begun
				}
				country_event = { id = BRG_education.6 days = 1 }
			}

			if = {
				limit = {
					NOT = { has_completed_focus = BRG_our_lineage_secured }
					any_owned_state = {
						check_variable = { THIS.HimmlerSupport < 20 }
						check_variable = { THIS.HimmlerSupport < THIS.CharlemagneSupport }
					}
					has_country_flag = BRG_Education_Crisis_Begun
				}
				country_event = { id = BRG_education.7 days = 1 }
			}

			if = {
				limit = {
					NOT = { has_completed_focus = BRG_our_lineage_secured }
					any_owned_state = {
						check_variable = { THIS.HimmlerSupport < 10 }
						check_variable = { THIS.HimmlerSupport < THIS.CharlemagneSupport }
					}
					has_country_flag = BRG_Education_Crisis_Begun
				}
				country_event = { id = BRG_education.8 days = 1 }
			}
		}
	}
}
