RKB_improve_fuel_tank_spirit = {
	if = {
		limit = {
			has_idea = RKB_reichs_fuel_tank_3
		}
		swap_ideas = {
			remove_idea = RKB_reichs_fuel_tank_3
			add_idea = RKB_reichs_fuel_tank_4
		}
		hidden_effect = {
			GER = {
				swap_ideas = {
					remove_idea = GER_reichs_fuel_tank_3
					add_idea = GER_reichs_fuel_tank_4
				}
			}
		}
	}
	else_if = {
		limit = {
			has_idea = RKB_reichs_fuel_tank_2
		}
		swap_ideas = {
			remove_idea = RKB_reichs_fuel_tank_2
			add_idea = RKB_reichs_fuel_tank_3
		}
		hidden_effect = {
			GER = {
				swap_ideas = {
					remove_idea = GER_reichs_fuel_tank_2
					add_idea = GER_reichs_fuel_tank_3
				}
			}
		}
	}
	else_if = {
		limit = {
			has_idea = RKB_reichs_fuel_tank_1
		}
		swap_ideas = {
			remove_idea = RKB_reichs_fuel_tank_1
			add_idea = RKB_reichs_fuel_tank_2
		}
		hidden_effect = {
			GER = {
				swap_ideas = {
					remove_idea = GER_reichs_fuel_tank_1
					add_idea = GER_reichs_fuel_tank_2
				}
			}
		}
	}
}

GGR_launch_goering_expanded = {
	set_global_flag = goering_expanded

	
	remove_country_leader_role = { # no idea why Speer gets the darker national socialism
		character = GER_albert_speer
		ideology = national_socialism_2_subtype
	}
	add_country_leader_role = {
		character = GER_albert_speer
		promote_leader = yes
		country_leader = {
			desc = "POLITICS_SPEER_GERMANY_DESC"
			ideology = national_socialism_3_subtype
			traits = { dictator }
			expire = "1999.1.1.1"
			id = -1
		}
	}
	add_country_leader_role = {
		character = GER_hermann_goring
		promote_leader = yes
		country_leader = {
			ideology = national_socialism_2_schorner_subtype
			expire = "2000.1.1.1"
			desc = "POLITICS_HERMANN_GORING_DESC"
			traits = { dictator uncle_of_the_reich }	
		}
	}
	add_country_leader_role = {
		character = GER_hermann_goring
		country_leader = {
			ideology = national_socialism_machiavellian_nazism_goring_subtype
			expire = "2000.1.1.1"
			desc = "POLITICS_HERMANN_GORING_DESC"
			traits = { dictator uncle_of_the_reich }	
		}
	}
	set_party_name = {
		ideology = national_socialism_2
		long_name = GGR_national_socialism_party_long
		name = GGR_national_socialism_party
	}
	set_party_name = {
		ideology = national_socialism_3
		long_name = GER_national_socialism_3
		name = GER_national_socialism_3
	}
	
	set_variable = { national_socialism_2_var = token:goring_nazism_token }
	set_variable = { national_socialism_3_var = token:GER_pre_GCW_national_socialism_2 }
	GGR_give_militarist_generals_traits = yes
}

GGR_launch_goering_expanded_post_cw = {
	## Ideas
	remove_all_ministers = yes
	remove_ideas = {
		GER_Fedor_von_Bock_high_command
		GER_Hans_Speidel_army_chief
		GER_Robert_Ritter_von_Greim_air_chief
		GER_Wernher_von_Braun_theorist
	}
	add_ideas = {
		#Spirits
		GER_GOR_lingering_traitors
		GGR_rebuilding_germany

		#Ministers
		GER_Wilhelm_Stuckart_hog
		GER_Rudolf_Diels_sec
		GER_Artur_Axmann_for
		GER_Paul_Korner_eco
		GER_Ferdinand_Schorner_high_command
		GER_Eduard_Wagner_high_command
		GER_Otto_Ernst_Remer_high_command
		GER_Werner_Osenberg_theorist
	}

	## Politics
	set_politics = { ruling_party = national_socialism }
	set_popularities = {
		national_socialism = 75
		national_socialism_2 = 25 #Schorner
	}
	
	add_country_leader_role = {
		character = GER_ferdinand_schorner
		country_leader = {
			ideology = national_socialism_stratocratic_nazism_subtype
			expire = "2000.1.1.1"
			#desc = "POLITICS_FERDINAND_SCHORNER_DESC" # added later on Goering's death
		}
	}
	add_country_leader_role = {
		character = GER_otto_ernst_remer
		country_leader = {
			ideology = national_socialism_ultramilitaristic_nazism_subtype
			expire = "2000.1.1.1"
		}
	}
	add_country_leader_role = {
		character = GER_otto_ernst_remer
		promote_leader = yes
		country_leader = {
			ideology = national_socialism_1_remer_subtype
			expire = "2000.1.1.1"
		}
	}
	add_country_leader_role = {
		character = GER_hans_speidel
		promote_leader = yes
		country_leader = {
			ideology = despotism_military_junta_subtype 
			expire = "2000.1.1.1"
		}
	}

	set_party_name = {
		ideology = national_socialism
		long_name = GER_national_socialism_party_long
		name = GER_national_socialism_party
	}

	set_party_name = {
		ideology = national_socialism_1
		long_name = GGR_national_socialism_party_long
		name = GGR_NSDAP_radikalen
	}	

	set_party_name = {
		ideology = national_socialism_2
		long_name = GGR_national_socialism_party_long
		name = GGR_national_socialism_party
	}

	set_party_name = {
		ideology = despotism
		long_name = GER_despotism_party_long
		name = GER_despotism_party
	}
	promote_character = {
		character = GER_hermann_goring
		ideology = national_socialism_machiavellian_nazism_goring_subtype
	}
	promote_character = {
		character = GER_ferdinand_schorner
		ideology = national_socialism_2_schorner_subtype
	}

	set_variable = { national_socialism_2_var = token:schorner_nazism_token }
	set_variable = { national_socialism_1_var = token:remer_nazism_token }

	## Content Setup
	load_focus_tree = {
		tree = GER_goering_main
		keep_completed = no
	}
	
	CZE = {
	    econ_join_sphere_GER = yes
	}

	## Event
	country_event = { id = goering.13 days = 5 }
	country_event = { id = goering.14 days = 6 }
	country_event = { id = goering.2 days = 3 }
	country_event = { id = goering.1703 days = 5 }
	country_event = { id = goering.1704 days = 8 }
	country_event = { id = goering.1705 days = 13 }
	country_event = { id = goering.1706 days = 18 }
	country_event = { id = goering_expanded.34 days = 17 }
	country_event = { id = goering.1707 days = 20 }

	## Kaukasus oil
	if = {
		limit = { CAU = { has_country_flag = CAU_policy_business_goering } }
		CAU = {
			give_resource_rights = { receiver = GER state = 229 resources = { oil aluminium rubber tungsten steel chromium uranium } }
			give_resource_rights = { receiver = GER state = 1552 resources = { oil aluminium rubber tungsten steel chromium uranium } }
			give_resource_rights = { receiver = GER state = 1554 resources = { oil aluminium rubber tungsten steel chromium uranium } }
		}
	}

	## Ireland Rejoining the Pakt
	IRE = { country_event = { id = IRE_eco_collapse.15 days = 100 } }

	# On Our Own mechanic timers
	ITA = { set_variable = { on_our_own_timer = 200 } }
	IND = { set_variable = { on_our_own_timer = 100 } }
	IBR = { set_variable = { on_our_own_timer = 100 } }
	BRA = { set_variable = { on_our_own_timer = 75 } }
	ENG = { set_variable = { on_our_own_timer = 50 } }
	SAF = { set_variable = { on_our_own_timer = 40 } }
	MAD = { set_variable = { on_our_own_timer = 35 } }
	CLL = { set_variable = { on_our_own_timer = 25 } }
	GRE = { set_variable = { on_our_own_timer = 25 } }
	BUL = { set_variable = { on_our_own_timer = 25 } }
	CUB = { set_variable = { on_our_own_timer = 20 } }
	SER = { set_variable = { on_our_own_timer = 20 } }
	BUL = { set_variable = { on_our_own_timer = 15 } }
	SUR = { set_variable = { on_our_own_timer = 10 } }
	GUY = { set_variable = { on_our_own_timer = 10 } }
	BLZ = { set_variable = { on_our_own_timer = 10 } }
	DOM = { set_variable = { on_our_own_timer = 10 } }
	URG = { set_variable = { on_our_own_timer = 10 } }
	JAM = { set_variable = { on_our_own_timer = 5 } }
	TRI = { set_variable = { on_our_own_timer = 3 } }
	CUR = { set_variable = { on_our_own_timer = 3 } }
	HAI = { set_variable = { on_our_own_timer = 3 } }
	every_country = {
		limit = {
			is_west_indies_nation = yes
		}
		set_variable = { THIS.on_our_own_timer = 7 }
	}
	every_country = {
		limit = {
			is_french_country = yes
		}
		set_variable = { THIS.on_our_own_timer = 20 }
	}

	# Gamerules
	if = {
		limit = {
			has_game_rule = { rule = GER_GGR_COUP option = GER_GGR_COUP_NO }
		}
		set_global_flag = i_dont_want_to_die
	}
	if = {
		limit = {
			has_game_rule = { rule = GER_GGR_MILITARIST_MECHANIC option = GER_GGR_MILITARIST_MECHANIC_OFF }
		}
		set_global_flag = piss_off
	}
	if = {
		limit = {
			has_game_rule = { rule = GER_GGR_NUCLEAR_WARFARE option = GER_GGR_NUCLEAR_WARFARE_OFF }
		}
		set_global_flag = nukes_disabled
	}
	if = {
		limit = {
			has_game_rule = { rule = GER_GGR_ALLIES_REJOINING option = GER_GGR_ALLIES_REJOINING_NO }
		}
		set_global_flag = goering_betrayed_allies
	}

	# Dispatch RK leaders
	TSM = {
		SWI_franz_burri = {
			set_nationality = SWI
		}
		UKR_eduard_wagner = {
			set_nationality = UKR
		}
		MCW_hans_krebs = {
			set_nationality = MCW
		}
		GLC_heinz_gunther_guderian = {
			set_nationality = GLC
		}
		CAU_alfred_becker = {
			set_nationality = CAU
		}
		OST_albert_bormann = {
			set_nationality = OST
		}
	}
	
	GGR_reuse_heydrichs_tags_for_WP0 = yes

	# Divisions limiters
	JAP = { set_variable = { num_division_limit = 250 } }
	USA = { set_variable = { num_division_limit = 250 } }
	ITA = { set_variable = { num_division_limit = 150 } }
	IND = { set_variable = { num_division_limit = 100 } }
	ENG = { set_variable = { num_division_limit = 100 } }
	
	# ARC annexes Zollverein as it's now useless
	ARC = {
		promote_character = ARC_All_Russian_Congress
		annex_country = {
			target = PKT
			transfer_troops = no
		}
		add_core_effect = yes
	}
	remove_war_buff = yes
}

GGR_give_militarist_generals_traits = {
	every_army_leader = {
		limit = {
			OR = {
				is_character = GER_ferdinand_schorner
				is_character = GER_eduard_wagner
				is_character = GER_johann_von_kielmansegg
				is_character = GER_gerhard_von_schwerin
				is_character = GER_friedrich_august_freiherr_von_der_heydte
				is_character = GER_friedrich_foertsch
				is_character = GER_leo_hepp
				is_character = GER_alfred_becker
				is_character = GER_erich_barenfanger
				is_character = GER_hansjoachim_hajo_herrmann
				is_character = GER_harald_von_hirschfeld
				is_character = GER_theodor_tolsdorff
				is_character = GER_otto_ernst_remer
				is_character = GER_werner_mummert
				is_character = GER_heinzgeorg_lemm
			}
			NOT = { has_trait = GGR_the_militarist }
		}
		add_trait = { trait = GGR_the_militarist }
	}
}

kill_country_leader_effect = {
	kill_country_leader = yes
}

GGR_determine_WPA_completion = {	
	if = {
		limit = {
			GGR_war_plan_A_completed = yes
		}
		set_temp_variable = { Victory_Outcome = 5 }
		#if = { # Return when remaking WPs
		#	limit = {
		#		OR = {
		#			SER = { is_subject_of = ITA }
		#			BUL = { is_subject_of = ITA }
		#			GRE = { is_subject_of = ITA }
		#			ENG = { is_in_faction_with = USA }
		#		}
		#	}
		#	set_temp_variable = { Victory_Outcome = 4 }
		#}
	}
}

GGR_lock_division_making = {
	every_state = {
		limit = {
			PREV = {
				divisions_in_state = {
					size > 0
					state = PREV
				}
			}
		}
		PREV = {
			delete_unit = {
				state = PREV
				disband = yes
			}
		}
	}
	country_lock_all_division_template = yes #disable division creating for RKs/MWs
}

add_core_effect = {
	every_owned_state = {
		limit = { NOT = { is_core_of = PREV } }
		add_core_of = PREV
	}
}

peace_out_effect = {
	every_enemy_country = {
		white_peace = PREV
	}
}

ai_wars_test = {
	log = "Stage 0:"
	every_country = {
		limit = {
			has_idea = ZZZ_war_stage_0
		}
		if = {
			limit = {
				has_war = yes
			}
			log = "[THIS.GetName], has war"
		}
		else = {
			log = "[THIS.GetName], no war"
		}
	}
	log = "Stage 1:"
	every_country = {
		limit = {
			has_idea = ZZZ_war_stage_1
		}
		if = {
			limit = {
				has_war = yes
			}
			log = "[THIS.GetName], has war"
		}
		else = {
			log = "[THIS.GetName], no war"
		}
	}
	log = "Stage 2:"
	every_country = {
		limit = {
			has_idea = ZZZ_war_stage_2
		}
		if = {
			limit = {
				has_war = yes
			}
			log = "[THIS.GetName], has war"
		}
		else = {
			log = "[THIS.GetName], no war"
		}
	}
	log = "Stage 3:"
	every_country = {
		limit = {
			has_idea = ZZZ_war_stage_3
		}
		if = {
			limit = {
				has_war = yes
			}
			log = "[THIS.GetName], has war"
		}
		else = {
			log = "[THIS.GetName], no war"
		}
	}
}