#### OLD ENGLAND CONTENT ENABLE EFFECT ####
ENG_OldBritain_Restore_For_History = {
	set_party_name = {
		ideology = conservatism
		name = ENG_OLD_conservatism_party
		long_name = ENG_OLD_conservatism_party_long
	}
	set_party_name = {
		ideology = liberal_conservatism
		name = ENG_OLD_liberal_conservatism_party
		long_name = ENG_OLD_liberal_conservatism_party_long
	}
	set_party_name = {
		ideology = paternalism
		name = ENG_OLD_paternalism_party
		long_name = ENG_OLD_paternalism_party_long
	}
	set_party_name = {
		ideology = fascism
		name = ENG_OLD_fascism_party
		long_name = ENG_OLD_fascism_party_long
	}

	set_cosmetic_tag = ENG_old

	ENG_Alec_Douglas_Home = {
		add_country_leader_role = {
			country_leader = {
				desc = "POLITICS_ALEC_DOUGLAS_HOME_DESC"
				expire = "1999.1.1"
				ideology = paternalism_controlled_democracy_subtype
				id = -1
			}
			promote_leader = yes
		}
	}
	### Spawn tags
	every_state = {
		limit = { is_SCO_state = yes }
		add_core_of = SCO
		transfer_state_to = SCO
	}
	every_state = {
		limit = { is_WAL_state = yes }
		add_core_of = WAL
		transfer_state_to = WAL
	}
	every_state = {
		limit = { is_CRN_state = yes }
		add_core_of = CRN
		transfer_state_to = CRN
	}

	remove_ideas = {
		### NATIONAL SPIRITS ###
		ENG_British_Free_Corps
		ENG_German_Corporate_Dominance_0
		ENG_The_Channel
		ENG_The_Terrible_Twins
	}

	add_ideas = {
		### NATIONAL SPIRITS ###
		ENG_Own_Peoples_Hate
		ENG_HMMLR
		ENG_Lying_In_Ruins
		ENG_Across_The_Channel #Added via on_startup on_action
	}
	set_politics = {
		ruling_party = paternalism
	}
}

ENG_OldBritain_ContentToggleEffect = {
	set_party_name = {
		ideology = conservatism
		name = ENG_OLD_conservatism_party
		long_name = ENG_OLD_conservatism_party_long
	}
	set_party_name = {
		ideology = liberal_conservatism
		name = ENG_OLD_liberal_conservatism_party
		long_name = ENG_OLD_liberal_conservatism_party_long
	}
	set_party_name = {
		ideology = paternalism
		name = ENG_OLD_paternalism_party
		long_name = ENG_OLD_paternalism_party_long
	}
	set_party_name = {
		ideology = fascism
		name = ENG_OLD_fascism_party
		long_name = ENG_OLD_fascism_party_long
	}

	# Clear any new leaders for good measure
	retire_character = ENG_Barry_Domvile
	retire_character = ENG_Edward_Short
	retire_character = ENG_Anthony_Crosland
	retire_character = ENG_Mark_Bonham_Carter
	retire_character = ENG_Barbara_Castle
	retire_character = ENG_Edmund_Veesenmayer
	retire_character = ENG_Gerard_Wallop
	retire_character = ENG_Jeffrey_Hamm
	retire_character = ENG_John_Bean
	retire_character = ENG_William_Joyce
	retire_character = ENG_Maxwell_Knight
	retire_character = ENG_Jack_Jones
	retire_character = ENG_William_Whitelaw
	retire_character = ENG_Keith_Joseph
	retire_character = ENG_Michael_Foot
	retire_character = ENG_Mick_McGahey

	# Clear new generals
	retire_character = ENG_Rudolf_Wulf
	retire_character = ENG_Thomas_Haller_Cooper
	retire_character = ENG_Charles_Harington
	retire_character = ENG_John_Cowley
	retire_character = ENG_James_Bowes_Lyon
	retire_character = ENG_Antony_Read
	retire_character = ENG_Thomas_Pearson
	retire_character = ENG_Edmund_Bacon
	retire_character = ENG_Max_Sachsenhimer
	retire_character = ENG_John_Nelson
	retire_character = ENG_Ian_Robertson
	retire_character = ENG_Gunther_Pape
	retire_character = ENG_Roland_Gibbs
	retire_character = ENG_Cecil_Blacker
	retire_character = ENG_Thomas_Mitford
	retire_character = ENG_Frank_Simpson
	retire_character = ENG_Walter_Walker

	# and the admirals
	retire_character = ENG_Angus_Graham
	retire_character = ENG_David_Boyle
	retire_character = ENG_Peter_Agnew
	retire_character = ENG_Robert_Bower

	FEN = {
		# Clear new generals
		retire_character = FEN_Jack_Jones
		retire_character = FEN_Fitzroy_Maclean
		retire_character = FEN_Gerald_Lathbury
		retire_character = FEN_James_Cassels
		retire_character = FEN_Terence_Airey
		retire_character = FEN_Geoffrey_Bourne
		retire_character = FEN_Michael_Carver
		retire_character = FEN_Jack_dAvigdor_Goldsmid
		retire_character = FEN_Eileen_Nolan
		retire_character = FEN_Ian_Gourlay
		retire_character = FEN_Derek_Lang
		retire_character = FEN_John_Frost
		retire_character = FEN_Guy_Campbell
		retire_character = FEN_Reginald_Hewetson
		retire_character = FEN_Christopher_Lee
		retire_character = FEN_Will_Paynter
		retire_character = FEN_Stephen_Spender
		retire_character = FEN_Edward_Heath
		retire_character = FEN_Frank_King
		retire_character = FEN_Grahame_Vivian

		retire_character = FEN_Caspar_John
		retire_character = FEN_Arthur_Hezlet
		retire_character = FEN_Varyl_Begg
	}

	ENG_Bernard_Montgomery = { promote_character = { ideology = despotism_military_junta_subtype } }

	ENG_Alec_Douglas_Home = {
		#add_country_leader_role = {
		#	country_leader = {
		#		desc = "POLITICS_ALEC_DOUGLAS_HOME_DESC"
		#		expire = "1999.1.1"
		#		ideology = paternalism_controlled_democracy_subtype
		#		id = -1
		#	}
		#	promote_leader = yes
		#}
		add_advisor_role = {
			advisor = {
				slot = head_of_government
				idea_token = ENG_Alec_Douglas_Home_hog
				traits = {
					head_of_government
					hog_pragmatic_statesman
				}
				ledger = civilian
				cost = -1
			}
			activate = yes
		}
	}
	ENG_Arthur_Kenneth_Chesterton = {
		#remove_country_leader_role = { ideology = fascism_british_fascism_1_subtype }
		add_country_leader_role = {
			country_leader = {
				desc = "POLITICS_ARTHUR_KENNETH_CHESTERTON_OLD_DESC"
				expire = "1999.1.1"
				ideology = fascism_corporatism_subtype
				id = -1
			}
			promote_leader = yes
		}
		remove_advisor_role = { slot = head_of_government }
		add_advisor_role = {
			advisor = {
				slot = security_minister
				idea_token = ENG_Arthur_Kenneth_Chesterton_sec
				traits = {
					security_minister
					sec_disliked_by_the_military
				}
				ledger = civilian
				cost = -1
			}
			activate = yes
		}
	}
	ENG_Andrew_Fountaine = {
		remove_advisor_role = { slot = head_of_government }
		add_advisor_role = {
			advisor = {
				slot = head_of_government
				idea_token = ENG_Andrew_Fountaine_hog_old
				traits = {
					head_of_government
					hog_political_protege
				}
				ledger = civilian
				cost = -1
			}
		}
	}
	ENG_Denis_Pirie = {
		remove_advisor_role = { slot = economy_minister }
		add_advisor_role = {
			advisor = {
				slot = economy_minister
				idea_token = ENG_Denis_Pirie_eco_old
				traits = {
					economy_minister
					eco_planned_economy_proponent
				}
				ledger = civilian
				cost = -1
			}
		}
	}
	ENG_Harold_Macmillan = {
		remove_country_leader_role = { ideology = conservatism_paternalistic_conservatism_subtype }
		add_country_leader_role = {
			country_leader = {
				desc = "POLITICS_HAROLD_MACMILLAN_DESC"
				expire = "1999.1.1"
				ideology = conservatism_paternalistic_conservatism_subtype
				id = -1
			}
			promote_leader = yes
		}
		add_advisor_role = {
			advisor = {
				slot = head_of_government
				idea_token = ENG_Harold_Macmillan_hog
				traits = {
					head_of_government
					hog_defender_of_democracy
				}
				ledger = civilian
				cost = -1
			}
		}
		add_advisor_role = {
			advisor = {
				slot = economy_minister
				idea_token = ENG_Harold_Macmillan_eco
				traits = {
					economy_minister
					eco_reformer
				}
				ledger = civilian
				cost = -1
			}
			activate = yes
		}
	}
	ENG_Rab_Butler = {
		#remove_country_leader_role = { ideology = paternalism_transitioning_democracy_subtype }
		#add_country_leader_role = {
		#	country_leader = {
		#		desc = "POLITICS_RAB_BUTLER_DESC_OLD"
		#		expire = "1999.1.1"
		#		ideology = paternalism_national_conservatism_subtype
		#		id = -1
		#	}
		#}
		add_advisor_role = {
			advisor = { # OLD COLLAB CONTENT
				slot = head_of_government
				idea_token = ENG_Rab_Butler_hog
				traits = {
					head_of_government
					hog_intelligentsia
				}
				ledger = civilian
				cost = -1
			}
		}
	}
	ENG_Reginald_Maudling = {
		add_country_leader_role = {
			country_leader = {
				desc = "POLITICS_REGINALD_MAUDLING_DESC"
				expire = "1999.1.1"
				ideology = liberal_conservatism_oligarchic_liberalism_subtype
				id = -1
			}
			promote_leader = yes
		}
		add_advisor_role = {
			advisor = {
				slot = head_of_government
				idea_token = ENG_Reginald_Maudling_hog
				traits = {
					head_of_government
					hog_believer_in_democracy
				}
				ledger = civilian
				cost = -1
			}
		}
	}
	ENG_Quintin_Hogg = {
		remove_advisor_role = { slot = foreign_minister }
		add_advisor_role = {
			advisor = {
				slot = foreign_minister
				idea_token = ENG_Quintin_Hogg_for_old
				traits = {
					foreign_minister
					for_political_appointment
				}
				ledger = civilian
				cost = -1
			}
			activate = yes
		}
	}

	### Spawn tags
	every_state = {
		limit = { is_SCO_state = yes }
		add_core_of = SCO
		transfer_state_to = SCO
	}
	every_state = {
		limit = { is_WAL_state = yes }
		add_core_of = WAL
		transfer_state_to = WAL
	}
	every_state = {
		limit = { is_CRN_state = yes }
		add_core_of = CRN
		transfer_state_to = CRN
	}

	#### OLD BRITISH ISLES TAGS ECON DEFINES ####
	ENG = {
		##Variable Initiation
		set_variable = { GDP = 47.366 } #in billions #already converted to billion
		set_variable = { GDP_growth = 1.1 }
		set_variable = { income_tax_rate = 0.23 }
		set_variable = { business_tax_rate = 0.13 }
		set_variable = { poverty_rate = 41.23 }
		set_variable = { poverty_monthly_change = 0.04 }
		set_variable = { national_debt = 27.16 } #in billions #already converted to billion
		set_variable = { economic_centralization = 55 }
		set_variable = { misc_income = 0.0 }
		set_variable = { base_inflation_rate = 0.0 }
		set_temp_variable = { temp_credit_rating = 5 }
		set_temp_variable = { temp_credit_rating_min = 6 }
		set_temp_variable = { temp_credit_rating_max = 8 }
		econ_initialize_credit_rating_system = yes
		initiate_display_vars = yes
	}
	WAL = {
		##Variable Initiation
		set_variable = { GDP = 1.709 } #in billions #already converted to billion
		set_variable = { GDP_growth = 3.7 }
		set_variable = { income_tax_rate = 0.15 }
		set_variable = { business_tax_rate = 0.05 }
		set_variable = { poverty_rate = 24 }
		set_variable = { poverty_monthly_change = 0.05 }
		set_variable = { national_debt = 0.940 } #in billions #already converted to billion
		set_variable = { economic_centralization = 53 }
		set_variable = { base_inflation_rate = 2.5 }
		set_temp_variable = { temp_credit_rating = 7 }
		set_temp_variable = { temp_credit_rating_min = 6 }
		set_temp_variable = { temp_credit_rating_max = 8 }
		econ_initialize_credit_rating_system = yes
		initiate_display_vars = yes
		#load_oob = "WAL_1962"
		#load_oob = "WAL_1962_air"
		#load_oob = "WAL_1962_naval"
		load_focus_tree = WAL_Initial_Tree
	}
	SCO = {
		##Variable Initiation
		set_variable = { GDP = 5.932 } #in billions
		set_variable = { GDP_growth = 4.0 }
		set_variable = { income_tax_rate = 0.22 }
		set_variable = { business_tax_rate = 0.19 }
		set_variable = { poverty_rate = 10 }
		set_variable = { base_inflation_rate = 0.8 }
		set_variable = { poverty_monthly_change = 0.1 }
		set_variable = { national_debt = 4.04 } #in billions
		set_variable = { misc_income = 0.48 }
		set_variable = { economic_centralization = 57 }
		set_temp_variable = { temp_credit_rating = 7 }
		set_temp_variable = { temp_credit_rating_min = 5 }
		set_temp_variable = { temp_credit_rating_max = 8 }
		econ_initialize_credit_rating_system = yes
		initiate_display_vars = yes
		#load_oob = "SCO_1962"
		#load_oob = "SCO_1962_naval"
		#load_oob = "SCO_1962_air"
		load_focus_tree = SCO_start
		
		country_event = { id = SCO.1970 days = 3169 }

		set_variable = { SCO_Election_Highlands_SNP = 52 }
		set_variable = { SCO_Election_Highlands_ILP = 45 }
		set_variable = { SCO_Election_Highlands_UP = 3 }
		set_variable = { SCO_Election_Highlands_SNP_Percentage = 0 }
		set_variable = { SCO_Election_Highlands_ILP_Percentage = 0 }
		set_variable = { SCO_Election_Highlands_UP_Percentage = 0 }
		set_variable = { SCO_Election_Highlands_Turnout = 30 }

		set_variable = { SCO_Election_Aberdeenshire_SNP = 55 }
		set_variable = { SCO_Election_Aberdeenshire_SNP_Percentage = 0 }
		set_variable = { SCO_Election_Aberdeenshire_ILP = 42 }
		set_variable = { SCO_Election_Aberdeenshire_ILP_Percentage = 0 }
		set_variable = { SCO_Election_Aberdeenshire_UP = 3 }
		set_variable = { SCO_Election_Aberdeenshire_UP_Percentage = 0 }
		set_variable = { SCO_Election_Aberdeenshire_Turnout = 47 }

		set_variable = { SCO_Election_Fife_SNP = 52 }
		set_variable = { SCO_Election_Fife_ILP = 28 }
		set_variable = { SCO_Election_Fife_UP = 20 }
		set_variable = { SCO_Election_Fife_SNP_Percentage = 0 }
		set_variable = { SCO_Election_Fife_ILP_Percentage = 0 }
		set_variable = { SCO_Election_Fife_UP_Percentage = 0 }
		set_variable = { SCO_Election_Fife_Turnout = 55 }

		set_variable = { SCO_Election_Lanark_SNP = 47 }
		set_variable = { SCO_Election_Lanark_ILP = 35 }
		set_variable = { SCO_Election_Lanark_UP = 18 }
		set_variable = { SCO_Election_Lanark_SNP_Percentage = 0 }
		set_variable = { SCO_Election_Lanark_ILP_Percentage = 0 }
		set_variable = { SCO_Election_Lanark_UP_Percentage = 0 }
		set_variable = { SCO_Election_Lanark_Turnout = 76 }

		set_variable = { SCO_Election_Dumfries_SNP = 28 }
		set_variable = { SCO_Election_Dumfries_ILP = 23 }
		set_variable = { SCO_Election_Dumfries_UP = 49 }
		set_variable = { SCO_Election_Dumfries_SNP_Percentage = 0 }
		set_variable = { SCO_Election_Dumfries_ILP_Percentage = 0 }
		set_variable = { SCO_Election_Dumfries_UP_Percentage = 0 }
		set_variable = { SCO_Election_Dumfries_Turnout = 68 }

		set_variable = { SCO_Election_Lothian_SNP = 27 }
		set_variable = { SCO_Election_Lothian_ILP = 33 }
		set_variable = { SCO_Election_Lothian_UP = 40 }
		set_variable = { SCO_Election_Lothian_SNP_Percentage = 0 }
		set_variable = { SCO_Election_Lothian_ILP_Percentage = 0 }
		set_variable = { SCO_Election_Lothian_UP_Percentage = 0 }
		set_variable = { SCO_Election_Lothian_Turnout = 77 }

		set_variable = { SCO_Election_National_SNP_Percentage = 0 }
		set_variable = { SCO_Election_National_ILP_Percentage = 0 }
		set_variable = { SCO_Election_National_UP_Percentage = 0 }
		set_variable = { SCO_Election_National_Turnout = 0 }
		set_variable = { SCO_Election_National_SNP_Turnout = 76 }
		set_variable = { SCO_Election_National_ILP_Turnout = 90 }
		set_variable = { SCO_Election_National_UP_Turnout = 88 }

		set_variable = { SCOparanoia = 5 }
		set_variable = { SCOhappiness = 3 }
		set_variable = { SCOoppression = 0 }
		set_variable = { SCOsuccessor = 0 }
		set_variable = { SCOcoupgovt = 0 }
		set_variable = { SCOconstitution = 0 }

		set_variable = { SCO_English_Population_Percent = 35 }
		set_variable = { SCO_English_Population_Percent_c = 0 }
		set_variable = { SCO_English_Poverty_Percent = 20 }
		set_variable = { SCO_English_Poverty_Percent_c = 0.05 }
		set_variable = { SCO_English_Approval = 24 }
		set_variable = { SCO_English_Approval_c = -0.2 }
		set_country_flag = SCO_Parliament_SNP_No_Coalition
	}
	CRN = {
		set_variable = { GDP = 0.941 } #in billions
		set_variable = { GDP_growth = 0.7 }
		set_variable = { income_tax_rate = 0.20 }
		set_variable = { business_tax_rate = 0.1 }
		set_variable = { poverty_rate = 20.21 }
		set_variable = { poverty_monthly_change = 0.1 }
		set_variable = { national_debt = 0.001 } #in billions
		set_variable = { misc_costs = 0.15 }
		initiate_display_vars = yes
		load_oob = "CRN_1962"
		load_oob = "CRN_navy_1962"
		GER = {
			add_to_faction = CRN
			set_autonomy = { target = CRN autonomy_state = autonomy_military_government }
		}
	}

	### Welsh/Scottish skeleton
	WAL = { country_event = { id = BRI_OLD_Skeleton.1 days = 550 } }
	SCO = { country_event = { id = BRI_OLD_Skeleton.2 days = 250 } }

	### Originally from on_startup
	ENG = {
		remove_ideas = ENG_Across_The_Channel
		add_ideas = ENG_Across_The_Channel
		country_event = { id = ENG_flavor.1 days = 434 }
		country_event = { id = ENG_flavor.7 days = 3289 }
		country_event = { id = ENG_flavor.14 days = 2726 }
	}
	WAL = {
		set_variable = { wal_coal_income = 0.25 }
		add_dynamic_modifier = { modifier = WAL_Welsh_coal_income }
		remove_ideas = WAL_welsh_coal_income_idea_dummy
		add_ideas = WAL_welsh_coal_income_idea
	}

	set_cosmetic_tag = ENG_old
	load_focus_tree = ENG_FT_Intro
	# ElectionSeason & ParliamentMech Initializers
	ParliamentMechanic_Initialize_Gamestart = yes

	set_variable = { ENG_Hardliner_SLP_Lovers = 0.40 }
	set_variable = { ENG_Reformers_SLP_Lovers = 0.60 }
	set_variable = { ENG_SLPReformation_process = 0.05 }
	set_variable = { ENG_NDL_Mec_Conserv_Strength = 0.15 }
	set_variable = { ENG_NDL_Mec_Moderate_Strength = 0.70 }
	set_variable = { ENG_NDL_Mec_Liberal_Strength = 0.15 }
	ENG_ThatcherSetVariables = yes
	ENG_MacmillanSetVariables = yes
	ENG_something_bad_maggie = yes
	SLP_GUI_REFRESH = yes
	MAC_GUI_REFRESH = yes
	add_political_power = 150

	set_politics = {
		ruling_party = paternalism
		last_election = "1935.11.14"
		election_frequency = 48
		elections_allowed = no
	}
	set_popularities = {
		conservatism = 26
		paternalism = 54
		despotism = 0
		fascism = 20
	}

	remove_ideas = {
		### FACTION ###
		Pakt_Mitstreiter

		### NATIONAL SPIRITS ###
		ENG_British_Free_Corps
		ENG_German_Corporate_Dominance_0
		ENG_The_Channel
		ENG_The_Terrible_Twins

		### MINISTERS ###
		ENG_Ronald_Nall_Cain_for
		ENG_Rab_Butler_eco
		ENG_Edmund_Veesenmayer_sec

		### POLITICAL ###
		tno_political_parties_one_party_state
		tno_religious_rights_secularism
		tno_trade_unions_nonsocialist_allowed
		tno_immigration_closed_borders
		tno_slavery_penal_labor
		tno_public_meetings_regulated
		tno_press_rights_state_press_only
		tno_vote_franchise_elite_voting

		### MILITARY ###
		tno_conscription_limited_conscription
		tno_military_supervision_no_supervision
		tno_training_basic_training
		tno_draft_exemptions_civil_service_deferment

		### ECONOMIC ###
		tno_trade_laws_limited_exports
		tno_income_taxation_low_income_weighted
		tno_minimum_wage_trinket_minimum_wage
		tno_max_workhours_12_hour_work_day
		tno_pensions_low_pensions
		tno_unemployment_trinket_subsidies

		### SOCIAL ###
		tno_health_care_low_income_protections
		tno_education_public_education
		tno_penal_system_harsh_penal_code
		tno_gender_rights_women_in_the_workplace
		tno_security_regulated_police
		tno_regulations_token_regulations

		### SOCIETAL DEVELOPMENT ###
		tno_academic_base_secondary_schooling
		tno_research_facilities_modern
		tno_agriculture_mass_mechanized
		tno_healthcare_developed
		tno_industrial_equipment_manufacturing_lines
		tno_industrial_expertise_experienced
		tno_admin_efficiency_deficient_administrative_systems
		tno_army_professionalism_political_interference
	}
	add_ideas = {
		### FACTION ###
		Pakt_Mitstreiter

		### NATIONAL SPIRITS ###
		ENG_Own_Peoples_Hate
		ENG_HMMLR
		ENG_Lying_In_Ruins
		ENG_Across_The_Channel #Added via on_startup on_action

		### MINISTERS ###

		### POLITICAL ###
		tno_political_parties_controlled_opposition
		tno_religious_rights_state_religion
		tno_trade_unions_illegal
		tno_immigration_closed_borders
		tno_slavery_penal_labor
		tno_public_meetings_regulated
		tno_press_rights_state_press_only
		tno_vote_franchise_elite_voting

		### MILITARY ###
		tno_conscription_limited_conscription
		tno_military_supervision_no_supervision
		tno_training_basic_training
		tno_draft_exemptions_civil_service_deferment

		### ECONOMIC ###
		tno_trade_laws_limited_exports
		tno_income_taxation_low_income_weighted
		tno_minimum_wage_trinket_minimum_wage
		tno_max_workhours_14_hour_work_day
		tno_pensions_low_pensions
		tno_unemployment_no_subsidies

		### SOCIAL ###
		tno_health_care_low_income_protections
		tno_education_public_education
		tno_penal_system_harsh_penal_code
		tno_gender_rights_women_in_the_workplace
		tno_security_regulated_police
		tno_regulations_token_regulations

		### MISC ###
		tno_refugees_banned
		tno_women_banned
		tno_racial_integration_none
		tno_child_labor_illegal
		tno_safety_limited_regulations
		tno_pollution_no_controls
		tno_lgbt_rights_lgbt_outlawed
		tno_minorities_oppression

		### SOCIETAL DEVELOPMENT ###
		tno_academic_base_secondary_schooling
		tno_research_facilities_modern
		tno_agriculture_mass_mechanized
		tno_healthcare_developed
		tno_industrial_equipment_manufacturing_lines
		tno_industrial_expertise_experienced
		tno_admin_efficiency_deficient_administrative_systems
		tno_army_professionalism_political_interference
	}
	### Political
	set_variable = { tno_political_parties_effectiveness = 60 }
	set_variable = { tno_religious_rights_effectiveness = 80 }
	set_variable = { tno_trade_unions_effectiveness = 70 }
	set_variable = { tno_immigration_effectiveness = 90 }
	set_variable = { tno_slavery_effectiveness = 100 }
	set_variable = { tno_public_meetings_effectiveness = 35 }
	set_variable = { tno_press_rights_effectiveness = 45 }
	set_variable = { tno_vote_franchise_effectiveness = 70 }

	### Military
	set_variable = { tno_conscription_effectiveness = 90 }
	set_variable = { tno_military_supervision_effectiveness = 100 }
	set_variable = { tno_training_effectiveness = 45 }
	set_variable = { tno_draft_exemptions_effectiveness = 75 }

	### Economic
	set_variable = { tno_trade_laws_effectiveness = 75 }
	set_variable = { tno_income_taxation_effectiveness = 60 }
	set_variable = { tno_minimum_wage_effectiveness = 55 }
	set_variable = { tno_max_workhours_effectiveness = 85 }
	set_variable = { tno_pensions_effectiveness = 75 }
	set_variable = { tno_unemployment_effectiveness = 100 }
	set_variable = { tno_regulations_effectiveness = 80 }

	### Social
	set_variable = { tno_health_care_effectiveness = 65 }
	set_variable = { tno_education_effectiveness = 45 }
	set_variable = { tno_penal_system_effectiveness = 65 }
	set_variable = { tno_gender_rights_effectiveness = 75 }
	set_variable = { tno_security_effectiveness = 35 }

	set_temp_variable = { TNO_economy_type_temp = token:Econ_Type_Capitalism }
	econ_type_change = yes
	set_variable = { economic_centralization = 75 }

	misc_law_array_startup = yes

	ENG = {
		set_country_flag = ENG_hide_debug_decisions
		set_variable = { ENG_OFN_Relations = 50 }
		set_variable = { ENG_Cornwall_Relations = 50 }
		set_variable = { ENG_Hmmlr_Guns = 500 }
		set_variable = { ENG_Collab_Guns = 500 }
		set_variable = { EnglishGoogleMaps_OpEfficiency = 50 }

		#Google Maps code
		every_owned_state = {
			set_variable = { ENG_StateStats_Stability = 50 }
			set_variable = { ENG_StateStats_RawHmmlrSupportTrend = 0 }
		}
		set_variable = { 131.ENG_StateStats_HmmlrSupport = 72.5 }
		set_variable = { 130.ENG_StateStats_HmmlrSupport = 72.5 }
		set_variable = { 132.ENG_StateStats_HmmlrSupport = 72.5 }
		set_variable = { 129.ENG_StateStats_HmmlrSupport = 50 }
		set_variable = { 128.ENG_StateStats_HmmlrSupport = 50 }
		set_variable = { 885.ENG_StateStats_HmmlrSupport = 50 }
		set_variable = { 125.ENG_StateStats_HmmlrSupport = 50 }
		set_variable = { 777.ENG_StateStats_HmmlrSupport = 50 }
		set_variable = { 338.ENG_StateStats_HmmlrSupport = 50 }
		set_variable = { 127.ENG_StateStats_HmmlrSupport = 27.5 }
		set_variable = { 126.ENG_StateStats_HmmlrSupport = 27.5 }
		set_variable = { 1300.ENG_StateStats_HmmlrSupport = 27.5 }
		set_variable = { 123.ENG_StateStats_Stability = 50 }
		set_variable = { ENG_EnglishGoogleMaps_ChosenState = 1300.id }
		#End Google Maps code
		set_variable = { ENG_EnglishEconomy_ChosenState = 1300.id }
	}
}

ENG_OldBritain_RemoveGenerals = { # Removes generals from old content if not enabled
	retire_character = ENG_Bernard_Montgomery
	retire_character = ENG_Orde_Wingate
	retire_character = ENG_Charles_Frederic_Keightley
	retire_character = ENG_Evelyn_Hugh_Barker
	retire_character = ENG_Geoffrey_Baker
	retire_character = ENG_Hugh_Charles_Stockwell
	retire_character = ENG_James_Cassels
	retire_character = ENG_Michael_Carver
	retire_character = ENG_Ronald_Gibbs
	retire_character = ENG_Philip_Vian
	retire_character = ENG_Victor_Crutchley
	remove_country_leader_role = {
		character = ENG_Alec_Douglas_Home
		ideology = paternalism_controlled_democracy_subtype
	}
	set_party_name = {
		ideology = conservatism
		name = ENG_conservatism_party
		long_name = ENG_conservatism_party_long
	}
	set_party_name = {
		ideology = liberal_conservatism
		name = ENG_liberal_conservatism_party
		long_name = ENG_liberal_conservatism_party_long
	}
	set_party_name = {
		ideology = paternalism
		name = ENG_paternalism_party
		long_name = ENG_paternalism_party_long
	}
	set_party_name = {
		ideology = fascism
		name = ENG_fascism_party
		long_name = ENG_fascism_party_long
	}
	drop_cosmetic_tag = yes
	annex_country = {
		target = CRN
		transfer_troops = no
	}
	annex_country = {
		target = SCO
		transfer_troops = no
	}
	annex_country = {
		target = WAL
		transfer_troops = no
	}
	add_ideas = {
		### NATIONAL SPIRITS ###
		ENG_British_Free_Corps
		ENG_German_Corporate_Dominance_0
		ENG_The_Channel
		ENG_The_Terrible_Twins
	}

	remove_ideas = {
		### NATIONAL SPIRITS ###
		ENG_Own_Peoples_Hate
		ENG_HMMLR
		ENG_Lying_In_Ruins
		ENG_Across_The_Channel #Added via on_startup on_action
	}

	set_politics = {
		ruling_party = fascism
	}

	FEN = {
		retire_character = FEN_David_Stirling
		retire_character = FEN_Bill_Alexander
		retire_character = FEN_Douglas_Kendrew
		retire_character = FEN_Frank_Kitson
		retire_character = FEN_John_Hackett
		retire_character = FEN_George_William_Symes
		retire_character = FEN_Richard_McCreery
		retire_character = FEN_James_Klugmann
		retire_character = FEN_Peter_Kerrigan
		retire_character = FEN_Bruce_Fraser
	}
}

####################################
####### Collab Pre-ECW Gun Smuggling #######
####################################


# Are you fucking kidding me why do I need to write these fucking scripts Bamba I never played England a single day in my life Bamba I am going to fucking murder y- Fetti
ENG_ClampCornwallRelations = {
	clamp_variable = {
		var = ENG_Cornwall_Relations
		min = 0
		max = 100
	}
}

ENG_CornwallRelations_Decrease_small = {
	add_to_variable = { ENG_Cornwall_Relations = -5 }
	custom_effect_tooltip = ENG_cornwall_support_decrease_tt
	ENG_ClampCornwallRelations = yes
}

ENG_CornwallRelations_Increase_small = {
	add_to_variable = { ENG_Cornwall_Relations = 5 }
	custom_effect_tooltip = ENG_cornwall_support_small_tt
	ENG_ClampCornwallRelations = yes
}

ENG_CornwallRelations_Increase_med = {
	add_to_variable = { ENG_Cornwall_Relations = 15 }
	custom_effect_tooltip = ENG_cornwall_support_medium_tt
	ENG_ClampCornwallRelations = yes
}

ENG_CornwallRelations_Increase_large = {
	add_to_variable = { ENG_Cornwall_Relations = 30 }
	custom_effect_tooltip = ENG_cornwall_support_large_tt
	ENG_ClampCornwallRelations = yes
}

ENG_IncreaseCollab_Support_vl = {
	hidden_effect = {
		add_to_variable = { ENG_StateStats_HmmlrSupport = -2.5 }
		ENG_ClampHmmlrSupport = yes
		ENG_GoogleMaps_Math = yes
	}
	custom_effect_tooltip = ENG_Collab_Support_increase_vl
}

ENG_IncreaseCollab_Support_low = {
	hidden_effect = {
		add_to_variable = { ENG_StateStats_HmmlrSupport = -5 }
		ENG_ClampHmmlrSupport = yes
		ENG_GoogleMaps_Math = yes
	}
	custom_effect_tooltip = ENG_Collab_Support_increase_low
}

ENG_IncreaseCollab_Support_med = {
	hidden_effect = {
		add_to_variable = { ENG_StateStats_HmmlrSupport = -10 }
		ENG_ClampHmmlrSupport = yes
		ENG_GoogleMaps_Math = yes
	}
	custom_effect_tooltip = ENG_Collab_Support_increase_med
}

ENG_IncreaseCollab_Support_high = {
	hidden_effect = {
		add_to_variable = { ENG_StateStats_HmmlrSupport = -20 }
		ENG_ClampHmmlrSupport = yes
		ENG_GoogleMaps_Math = yes
	}
	custom_effect_tooltip = ENG_Collab_Support_increase_high
}

ENG_IncreaseHMMLR_Support_vl = {
	hidden_effect = {
		add_to_variable = { ENG_StateStats_HmmlrSupport = 2.5 }
		ENG_ClampHmmlrSupport = yes
		ENG_GoogleMaps_Math = yes
	}
	custom_effect_tooltip = ENG_HMMLR_Support_increase_vl
}

ENG_IncreaseHMMLR_Support_low = {
	hidden_effect = {
		add_to_variable = { ENG_StateStats_HmmlrSupport = 5 }
		ENG_ClampHmmlrSupport = yes
		ENG_GoogleMaps_Math = yes
	}
	custom_effect_tooltip = ENG_HMMLR_Support_increase_low
}

ENG_IncreaseHMMLR_Support_med = {
	hidden_effect = {
		add_to_variable = { ENG_StateStats_HmmlrSupport = 10 }
		ENG_ClampHmmlrSupport = yes
		ENG_GoogleMaps_Math = yes
	}
	custom_effect_tooltip = ENG_HMMLR_Support_increase_med
}

ENG_IncreaseHMMLR_Support_high = {
	hidden_effect = {
		add_to_variable = { ENG_StateStats_HmmlrSupport = 20 }
		ENG_ClampHmmlrSupport = yes
		ENG_GoogleMaps_Math = yes
	}
	custom_effect_tooltip = ENG_HMMLR_Support_increase_high
}

ENG_DecreaseHMMLR_Support_vl = {
	hidden_effect = {
		add_to_variable = { ENG_StateStats_HmmlrSupport = -2.5 }
		ENG_ClampHmmlrSupport = yes
		ENG_GoogleMaps_Math = yes
	}
	custom_effect_tooltip = ENG_HMMLR_Support_Decrease_vl
}

ENG_DecreaseHMMLR_Support_low = {
	hidden_effect = {
		add_to_variable = { ENG_StateStats_HmmlrSupport = -5 }
		ENG_ClampHmmlrSupport = yes
		ENG_GoogleMaps_Math = yes
	}
	custom_effect_tooltip = ENG_HMMLR_Support_Decrease_low
}

ENG_DecreaseHMMLR_Support_med = {
	hidden_effect = {
		add_to_variable = { ENG_StateStats_HmmlrSupport = -10 }
		ENG_ClampHmmlrSupport = yes
		ENG_GoogleMaps_Math = yes
	}
	custom_effect_tooltip = ENG_HMMLR_Support_Decrease_med
}

ENG_DecreaseHMMLR_Support_high = {
	hidden_effect = {
		add_to_variable = { ENG_StateStats_HmmlrSupport = -20 }
		ENG_ClampHmmlrSupport = yes
		ENG_GoogleMaps_Math = yes
	}
	custom_effect_tooltip = ENG_HMMLR_Support_Decrease_high
}

ENG_Increase_Stab_low = {
	add_to_variable = { ENG_StateStats_Stability = 5 }
	ENG_ClampStateStability = yes
	custom_effect_tooltip = ENG_State_Stab_increase5.tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_Increase_Stab_med = {
	add_to_variable = { ENG_StateStats_Stability = 10 }
	ENG_ClampStateStability = yes
	custom_effect_tooltip = ENG_State_Stab_increase10.tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_Increase_Stab_highmed = {
	add_to_variable = { ENG_StateStats_Stability = 15 }
	ENG_ClampStateStability = yes
	custom_effect_tooltip = ENG_State_Stab_increase15.tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_Increase_Stab_high = {
	add_to_variable = { ENG_StateStats_Stability = 20 }
	ENG_ClampStateStability = yes
	custom_effect_tooltip = ENG_State_Stab_increase20.tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_Decrease_Stab_low = {
	add_to_variable = { ENG_StateStats_Stability = -5 }
	ENG_ClampStateStability = yes
	custom_effect_tooltip = ENG_State_Stab_decrease5.tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_Decrease_Stab_med = {
	add_to_variable = { ENG_StateStats_Stability = -10 }
	ENG_ClampStateStability = yes
	custom_effect_tooltip = ENG_State_Stab_decrease10.tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_Decrease_Stab_highmed = {
	add_to_variable = { ENG_StateStats_Stability = -15 }
	ENG_ClampStateStability = yes
	custom_effect_tooltip = ENG_State_Stab_decrease15.tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_Decrease_Stab_high = {
	add_to_variable = { ENG_StateStats_Stability = -20 }
	ENG_ClampStateStability = yes
	custom_effect_tooltip = ENG_State_Stab_decrease20.tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_DecreaseHMMLR_Trend_low = {
	add_to_variable = { ENG_StateStats_RawHmmlrSupportTrend = -0.5 }
	custom_effect_tooltip = ENG_HMMLR_Trend_decrease_sml_tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_DecreaseHMMLR_Trend_med = {
	add_to_variable = { ENG_StateStats_RawHmmlrSupportTrend = -1 }
	custom_effect_tooltip = ENG_HMMLR_Trend_decrease_med_tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_IncreaseHMMLR_Trend_low = {
	add_to_variable = { ENG_StateStats_RawHmmlrSupportTrend = 0.5 }
	custom_effect_tooltip = ENG_HMMLR_Trend_increase_sml_tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_IncreaseHMMLR_Trend_med = {
	add_to_variable = { ENG_StateStats_RawHmmlrSupportTrend = 1 }
	custom_effect_tooltip = ENG_HMMLR_Trend_increase_med_tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_DecreaseCollab_Trend_low = {
	add_to_variable = { ENG_StateStats_RawHmmlrSupportTrend = 0.5 }
	custom_effect_tooltip = ENG_Collab_Trend_decrease_sml_tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_DecreaseCollab_Trend_med = {
	add_to_variable = { ENG_StateStats_RawHmmlrSupportTrend = 1 }
	custom_effect_tooltip = ENG_Collab_Trend_decrease_med_tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_IncreaseCollab_Trend_low = {
	add_to_variable = { ENG_StateStats_RawHmmlrSupportTrend = -0.5 }
	custom_effect_tooltip = ENG_Collab_Trend_increase_sml_tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_IncreaseCollab_Trend_med = {
	add_to_variable = { ENG_StateStats_RawHmmlrSupportTrend = -1 }
	custom_effect_tooltip = ENG_Collab_Trend_increase_med_tt
	hidden_effect = {
		ENG_GoogleMaps_Math = yes
	}
}

ENG_CollabGunsPlus_1000 = {
	# Small shipment goes through SW state with highest stability

	# Find highest stability
	set_temp_variable = { max_stab = 1300.ENG_StateStats_Stability }
	if = {
		limit = { check_variable = { 127.ENG_StateStats_Stability > max_stab } }
		set_temp_variable = { max_stab = 127.ENG_StateStats_Stability }
	}
	if = {
		limit = { check_variable = { 338.ENG_StateStats_Stability > max_stab } }
		set_temp_variable = { max_stab = 338.ENG_StateStats_Stability }
	}

	# Determine outcome based on stability value. Assume 70% of "lost" guns taken by HMMLR
	if = {
		limit = { check_variable = { max_stab > 69.9 } }
		add_to_variable = { ENG_Collab_Guns = 100 }
		country_event = { id = ENG_ForShip.8 }
	}
	else_if = {
		limit = { check_variable = { max_stab > 44.9 } }
		add_to_variable = { ENG_Collab_Guns = 50 }
		add_to_variable = { ENG_Hmmlr_Guns = 35 }
		country_event = { id = ENG_ForShip.9 }
	}
	else_if = {
		limit = { check_variable = { max_stab > 19.9 } }
		add_to_variable = { ENG_Collab_Guns = 25 }
		add_to_variable = { ENG_Hmmlr_Guns = 52 }
		country_event = { id = ENG_ForShip.10 }
	}
	else = {
		add_to_variable = { ENG_Hmmlr_Guns = 70 }
		country_event = { id = ENG_ForShip.11 }
	}
}

ENG_CollabGunsPlus_5000 = {
	# Medium shipment goes through the two SW states with highest stability

	# First get the three stability pairs
	set_temp_variable = { stab1 = 1300.ENG_StateStats_Stability }
	add_to_temp_variable = { stab1 = 127.ENG_StateStats_Stability }
	divide_temp_variable = { stab1 = 2 }
	set_temp_variable = { stab2 = 1300.ENG_StateStats_Stability }
	add_to_temp_variable = { stab2 = 338.ENG_StateStats_Stability }
	divide_temp_variable = { stab2 = 2 }
	set_temp_variable = { max_stab = 127.ENG_StateStats_Stability }
	add_to_temp_variable = { max_stab = 338.ENG_StateStats_Stability }
	divide_temp_variable = { max_stab = 2 }

	# Compare all three stability pairs to find max
	if = {
		limit = { check_variable = { stab1 > max_stab } }
		set_temp_variable = { max_stab = stab1 }
	}
	if = {
		limit = { check_variable = { stab2 > max_stab } }
		set_temp_variable = { max_stab = stab2 }
	}

	# Determine outcome based on stability value. Assume 70% of "lost" guns taken by HMMLR
	if = {
		limit = { check_variable = { max_stab > 69.9 } }
		add_to_variable = { ENG_Collab_Guns = 500 }
		country_event = { id = ENG_ForShip.8 }
	}
	else_if = {
		limit = { check_variable = { max_stab > 44.9 } }
		add_to_variable = { ENG_Collab_Guns = 250 }
		add_to_variable = { ENG_Hmmlr_Guns = 175 }
		country_event = { id = ENG_ForShip.9 }
	}
	else_if = {
		limit = { check_variable = { max_stab > 19.9 } }
		add_to_variable = { ENG_Collab_Guns = 125 }
		add_to_variable = { ENG_Hmmlr_Guns = 262 }
		country_event = { id = ENG_ForShip.10 }
	}
	else = {
		add_to_variable = { ENG_Hmmlr_Guns = 350 }
		country_event = { id = ENG_ForShip.11 }
	}
}

ENG_CollabGunsPlus_9500 = {
	# Large shipment goes through all three SW states

	# Get state stability average
	set_temp_variable = { max_stab = 1300.ENG_StateStats_Stability }
	add_to_temp_variable = { max_stab = 127.ENG_StateStats_Stability }
	add_to_temp_variable = { max_stab = 338.ENG_StateStats_Stability }
	divide_temp_variable = { max_stab = 3 }

	# Determine outcome based on stability value. Assume 70% of "lost" guns taken by HMMLR
	if = {
		limit = { check_variable = { max_stab > 69.9 } }
		add_to_variable = { ENG_Collab_Guns = 950 }
		country_event = { id = ENG_ForShip.8 }
	}
	else_if = {
		limit = { check_variable = { max_stab > 44.9 } }
		add_to_variable = { ENG_Collab_Guns = 475 }
		add_to_variable = { ENG_Hmmlr_Guns = 332 }
		country_event = { id = ENG_ForShip.9 }
	}
	else_if = {
		limit = { check_variable = { max_stab > 19.9 } }
		add_to_variable = { ENG_Collab_Guns = 237 }
		add_to_variable = { ENG_Hmmlr_Guns = 499 }
		country_event = { id = ENG_ForShip.10 }
	}
	else = {
		add_to_variable = { ENG_Hmmlr_Guns = 665 }
		country_event = { id = ENG_ForShip.11 }
	}
}

####################################
####### HMMLR Pre-ECW Gun Smuggling #######
####################################

ENG_HmmlrGunsPlus_1000 = {
	# Small shipment goes through NE state with lowest stability

	# Find lowest stability
	set_temp_variable = { min_stab = 130.ENG_StateStats_Stability }
	if = {
		limit = { check_variable = { 131.ENG_StateStats_Stability < min_stab } }
		set_temp_variable = { min_stab = 131.ENG_StateStats_Stability }
	}
	if = {
		limit = { check_variable = { 132.ENG_StateStats_Stability < min_stab } }
		set_temp_variable = { min_stab = 132.ENG_StateStats_Stability }
	}

	# Determine outcome based on stability value. Assume 70% of "lost" guns taken by Collabs
	if = {
		limit = { check_variable = { min_stab < 30.1 } }
		add_to_variable = { ENG_Hmmlr_Guns = 100 }
		country_event = { id = ENG_ForShip.8 }
	}
	else_if = {
		limit = { check_variable = { min_stab < 55.1 } }
		add_to_variable = { ENG_Hmmlr_Guns = 50 }
		add_to_variable = { ENG_Collab_Guns = 35 }
		country_event = { id = ENG_ForShip.9 }
	}
	else_if = {
		limit = { check_variable = { min_stab < 80.1 } }
		add_to_variable = { ENG_Hmmlr_Guns = 25 }
		add_to_variable = { ENG_Collab_Guns = 52 }
		country_event = { id = ENG_ForShip.10 }
	}
	else = {
		add_to_variable = { ENG_Collab_Guns = 70 }
		country_event = { id = ENG_ForShip.11 }
	}
	clr_country_flag = Hmmlr_guns_small
}

ENG_HmmlrGunsPlus_5000 = {
	# Medium shipment goes through the two NE states with lowest stability

	# First get the three stability pairs
	set_temp_variable = { stab1 = 130.ENG_StateStats_Stability }
	add_to_temp_variable = { stab1 = 131.ENG_StateStats_Stability }
	divide_temp_variable = { stab1 = 2 }
	set_temp_variable = { stab2 = 130.ENG_StateStats_Stability }
	add_to_temp_variable = { stab2 = 132.ENG_StateStats_Stability }
	divide_temp_variable = { stab2 = 2 }
	set_temp_variable = { min_stab = 132.ENG_StateStats_Stability }
	add_to_temp_variable = { min_stab = 131.ENG_StateStats_Stability }
	divide_temp_variable = { min_stab = 2 }

	# Compare all three stability pairs to find min
	if = {
		limit = { check_variable = { stab1 < min_stab } }
		set_temp_variable = { min_stab = stab1 }
	}
	if = {
		limit = { check_variable = { stab2 < min_stab } }
		set_temp_variable = { min_stab = stab2 }
	}

	# Determine outcome based on stability value. Assume 70% of "lost" guns taken by Collabs
	if = {
		limit = { check_variable = { min_stab < 30.1 } }
		add_to_variable = { ENG_Hmmlr_Guns = 500 }
		country_event = { id = ENG_ForShip.8 }
	}
	else_if = {
		limit = { check_variable = { min_stab < 55.1 } }
		add_to_variable = { ENG_Hmmlr_Guns = 250 }
		add_to_variable = { ENG_Collab_Guns = 175 }
		country_event = { id = ENG_ForShip.9 }
	}
	else_if = {
		limit = { check_variable = { min_stab < 80.1 } }
		add_to_variable = { ENG_Hmmlr_Guns = 125 }
		add_to_variable = { ENG_Collab_Guns = 262 }
		country_event = { id = ENG_ForShip.10 }
	}
	else = {
		add_to_variable = { ENG_Collab_Guns = 350 }
		country_event = { id = ENG_ForShip.11 }
	}
	clr_country_flag = Hmmlr_guns_medium
}

ENG_HmmlrGunsPlus_9500 = {
	# Large shipment goes through all three NE states

	# Get state stability average
	set_temp_variable = { min_stab = 130.ENG_StateStats_Stability }
	add_to_temp_variable = { min_stab = 131.ENG_StateStats_Stability }
	add_to_temp_variable = { min_stab = 132.ENG_StateStats_Stability }
	divide_temp_variable = { min_stab = 3 }

	# Determine outcome based on stability value. Assume 70% of "lost" guns taken by Collabs
	if = {
		limit = { check_variable = { min_stab < 30.1 } }
		add_to_variable = { ENG_Hmmlr_Guns = 950 }
		country_event = { id = ENG_ForShip.8 }
	}
	else_if = {
		limit = { check_variable = { min_stab < 55.1 } }
		add_to_variable = { ENG_Hmmlr_Guns = 475 }
		add_to_variable = { ENG_Collab_Guns = 332 }
		country_event = { id = ENG_ForShip.9 }
	}
	else_if = {
		limit = { check_variable = { min_stab < 80.1 } }
		add_to_variable = { ENG_Hmmlr_Guns = 237 }
		add_to_variable = { ENG_Collab_Guns = 499 }
		country_event = { id = ENG_ForShip.10 }
	}
	else = {
		add_to_variable = { ENG_Collab_Guns = 665 }
		country_event = { id = ENG_ForShip.11 }
	}
	clr_country_flag = Hmmlr_guns_large
}

ENG_HmmlrGunsSpecial = {
	# Special shipment goes through all three NE states

	# Get state stability average
	set_temp_variable = { max_stab = 130.ENG_StateStats_Stability }
	add_to_temp_variable = { max_stab = 131.ENG_StateStats_Stability }
	add_to_temp_variable = { max_stab = 132.ENG_StateStats_Stability }
	divide_temp_variable = { max_stab = 3 }

	# Determine outcome based on stability value and prior successful shipments
	if = {
		limit = {
			NOT = { has_country_flag = ENG_HMMLR_Tank_1 }
			NOT = { has_country_flag = ENG_HMMLR_Tank_2 }
			NOT = { has_country_flag = ENG_HMMLR_Tank_3 }
			check_variable = { max_stab < 30.1 }
		}
		set_country_flag = ENG_HMMLR_Tank_1
		if = {
			limit = {
				NOT = { has_country_flag = Hmmlr_special_shipment_1 }
			}
			country_event = { id = ENG_ForShip.14 }
		}
	}
	else_if = {
		limit = {
			has_country_flag = ENG_HMMLR_Tank_1
			check_variable = { max_stab < 30.1 }
		}
		clr_country_flag = ENG_HMMLR_Tank_1
		set_country_flag = ENG_HMMLR_Tank_2
		if = {
			limit = {
				NOT = { has_country_flag = Hmmlr_special_shipment_1 }
			}
			country_event = { id = ENG_ForShip.14 }
		}
	}
	else_if = {
		limit = {
			has_country_flag = ENG_HMMLR_Tank_2
			check_variable = { max_stab < 30.1 }
		}
		clr_country_flag = ENG_HMMLR_Tank_2
		set_country_flag = ENG_HMMLR_Tank_3
		if = {
			limit = {
				NOT = { has_country_flag = Hmmlr_special_shipment_1 }
			}
			country_event = { id = ENG_ForShip.14 }
		}
	}
	else = {
		country_event = { id = ENG_ForShip.15 }
	}
	clr_country_flag = Hmmlr_guns_special
}

ENG_ClampOFNRelations = {
	clamp_variable = {
		var = ENG_OFN_Relations
		min = 0
		max = 100
	}
}

ENG_ConvertGunsToEquipment = {
	#This converts remaining guns into WW1 infantry equipment at a 10:1 ratio
	clamp_variable = {
		var = ENG.ENG_Hmmlr_Guns
		min = 0
		max = 990000
	}
	clamp_variable = {
		var = ENG.ENG_Collab_Guns
		min = 0
		max = 990000
	}
	round_variable = ENG.ENG_Hmmlr_Guns
	round_variable = ENG.ENG_Collab_Guns
	FEN = {
		add_equipment_to_stockpile = {
			type = infantry_equipment_0
			amount = USA.ENG_Hmmlr_Guns
			producer = USA
		}
		add_equipment_to_stockpile = {
			type = anti_tank_equipment_1
			amount = USA.ENG_CIA_AT
			producer = USA
		}
		add_equipment_to_stockpile = {
			type = artillery_equipment_3
			amount = USA.ENG_CIA_ART
			producer = USA
		}
	}
	ENG = {
		add_equipment_to_stockpile = {
			type = infantry_equipment_0
			amount = ENG.ENG_Collab_Guns
			producer = ENG
		}
	}
}

###################################
####### English Civil War (ECW) OOBs #######
###################################

ECW_State_transfer = {
	CRN = {
		#transfer_state = 123
		#transfer_state = 1296
		#123 = {
		#	set_demilitarized_zone = no
		#	add_core_of = CRN
		#}
		#1296 = {
		#	set_demilitarized_zone = no
		#	add_core_of = CRN
		#}
	}
	ENG = {
		every_owned_state = {
			add_core_of = FEN
		}
		every_owned_state = {
			limit = {
				NOT = { check_variable = { ENG_StateStats_HmmlrSupport < 50 } }
				NOT = { state = 131 }
				NOT = { state = 1300 }
			}
			FEN = { transfer_state = PREV }
		}
		if = {
			limit = { check_variable = { FEN.number_of_states = 0 } }
			FEN = { transfer_state = 131 }
		}
		if = {
			limit = {
				check_variable = { ENG.number_of_states > 1 }
				1300 = { NOT = { check_variable = { ENG_StateStats_HmmlrSupport < 50 } } }
			}
			FEN = { transfer_state = 1300 }
		}
	}

	#giving the states that are split
	if = {
		limit = {
			131 = {
				is_owned_by = FEN
			}
		}
		FEN = {
			transfer_state = 2003
			transfer_state = 2005
			set_province_controller = 16345
		}
	}
	if = {
		limit = {
			132 = {
				is_owned_by = FEN
			}
		}
		FEN = {
			transfer_state = 2000
			transfer_state = 2001
			transfer_state = 2004
		}
	}
	if = {
		limit = {
			130 = {
				is_owned_by = FEN
			}
		}
		FEN = {
			transfer_state = 2006
			transfer_state = 2007
		}
	}
	if = {
		limit = {
			128 = {
				is_owned_by = FEN
			}
		}
		FEN = {
			transfer_state = 2002
			transfer_state = 2010
		}
	}
	if = {
		limit = {
			129 = {
				is_owned_by = FEN
			}
		}
		FEN = {
			transfer_state = 2008
			transfer_state = 2009
		}
	}
	if = {
		limit = {
			125 = {
				is_owned_by = FEN
			}
		}
		FEN = {
			transfer_state = 2012
			transfer_state = 2013
		}
	}
	if = {
		limit = {
			126 = {
				is_owned_by = FEN
			}
		}
		FEN = {
			transfer_state = 2011
			transfer_state = 2014
		}
	}
	if = {
		limit = {
			777 = {
				is_owned_by = FEN
			}
		}
		FEN = {
			transfer_state = 126
		}
	}
	if = {
		limit = {
			127 = {
				is_owned_by = FEN
			}
		}
		FEN = {
			transfer_state = 2015
		}
	}
	else_if = {
		limit = {
			127 = {
				is_owned_by = ENG
			}
		}
		ENG = {
			transfer_state = 777
			transfer_state = 2015
		}
	}
	if = {
		limit = {
			125 = {
				is_owned_by = FEN
			}
		}
		FEN = {
			transfer_state = 2012
			transfer_state = 2013
		}
	}
}

ENG_EnglishCivlWarOOB = {
	log = "[GetDateText]: [Root.GetName]: ENG_EnglishCivlWarOOB; Executing"
	# This determines the ECW OOB to load
	ENG_ConvertGunsToEquipment = yes

	every_state = {
		limit = {
			OR = {
				is_owned_by = ENG
				is_owned_by = FEN
			}
		}
		set_variable = { FEN_mbat_count = ENG_StateStats_HmmlrSupport }
		multiply_variable = { FEN_mbat_count = 0.16 }
		round_variable = FEN_mbat_count
		set_variable = { ENG_mbat_count = 16 }
		subtract_from_variable = { ENG_mbat_count = FEN_mbat_count }

		set_temp_variable = { FEN_mdbat_count = FEN_mbat_count }
		modulo_temp_variable = { FEN_mdbat_count = 5 }
		subtract_from_variable = { FEN_mbat_count = FEN_mdbat_count }
		divide_variable = { FEN_mbat_count = 5 }

		set_temp_variable = { ENG_mdbat_count = ENG_mbat_count }
		modulo_temp_variable = { ENG_mdbat_count = 5 }
		subtract_from_variable = { ENG_mbat_count = ENG_mdbat_count }
		divide_variable = { ENG_mbat_count = 5 }

		set_temp_variable = { ENG_stabperc = ENG_StateStats_Stability }
		divide_temp_variable = { ENG_stabperc = 100 }
		set_temp_variable = { FEN_stabperc = 1 }
		subtract_from_temp_variable = { FEN_stabperc = ENG_stabperc }

		if = {
			limit = {
				is_owned_by = FEN
			}
			FEN_create_militia = yes
			ENG_create_militia = yes
		}
		else = {
			ENG_create_militia = yes
			FEN_create_militia = yes
		}

		FEN = {
			capital_scope = {
				meta_effect = {
					text = {
						create_unit = {
							division = "division_template = \"Disband\"	start_experience_factor = 0.2	start_equipment_factor = [FEN_eq]"
							owner = FEN
							allow_spawning_on_enemy_provs = no
							count = PREV.PREV.FEN_mdbat_count
						}
					}
					FEN_eq = "[?PREV.PREV.FEN_stabperc]"
				}
			}
		}

		ENG = {
			capital_scope = {
				meta_effect = {
					text = {
						create_unit = {
							division = "division_template = \"Disband\"	start_experience_factor = 0.2	start_equipment_factor = [ENG_eq]"
							owner = ENG
							allow_spawning_on_enemy_provs = no
							count = PREV.PREV.ENG_mdbat_count
						}
					}
					ENG_eq = "[?PREV.PREV.ENG_stabperc]"
				}
			}
		}
	}

	132 = {
		set_variable = { ENG_Region_Hmmlr_Support = 130.ENG_StateStats_HmmlrSupport }
		add_to_variable = { ENG_Region_Hmmlr_Support = 131.ENG_StateStats_HmmlrSupport }
		add_to_variable = { ENG_Region_Hmmlr_Support = 132.ENG_StateStats_HmmlrSupport }
		set_variable = { ENG_Region_Stab = 130.ENG_StateStats_Stability }
		add_to_variable = { ENG_Region_Stab = 131.ENG_StateStats_Stability }
		add_to_variable = { ENG_Region_Stab = 132.ENG_StateStats_Stability }
		set_temp_variable = { ENG_region_setup_target = 132 }
		ENG_region_setup = yes
	}
	338 = {
		set_variable = { ENG_Region_Hmmlr_Support = 885.ENG_StateStats_HmmlrSupport }
		add_to_variable = { ENG_Region_Hmmlr_Support = 338.ENG_StateStats_HmmlrSupport }
		add_to_variable = { ENG_Region_Hmmlr_Support = 777.ENG_StateStats_HmmlrSupport }
		set_variable = { ENG_Region_Stab = 885.ENG_StateStats_Stability }
		add_to_variable = { ENG_Region_Stab = 338.ENG_StateStats_Stability }
		add_to_variable = { ENG_Region_Stab = 777.ENG_StateStats_Stability }
		set_temp_variable = { ENG_region_setup_target = 338 }
		ENG_region_setup = yes
	}
	128 = {
		set_variable = { ENG_Region_Hmmlr_Support = 125.ENG_StateStats_HmmlrSupport }
		add_to_variable = { ENG_Region_Hmmlr_Support = 128.ENG_StateStats_HmmlrSupport }
		add_to_variable = { ENG_Region_Hmmlr_Support = 129.ENG_StateStats_HmmlrSupport }
		set_variable = { ENG_Region_Stab = 125.ENG_StateStats_Stability }
		add_to_variable = { ENG_Region_Stab = 128.ENG_StateStats_Stability }
		add_to_variable = { ENG_Region_Stab = 129.ENG_StateStats_Stability }
		set_temp_variable = { ENG_region_setup_target = 128 }
		ENG_region_setup = yes
	}
	1300 = {
		set_variable = { ENG_Region_Hmmlr_Support = 126.ENG_StateStats_HmmlrSupport }
		add_to_variable = { ENG_Region_Hmmlr_Support = 127.ENG_StateStats_HmmlrSupport }
		add_to_variable = { ENG_Region_Hmmlr_Support = 1300.ENG_StateStats_HmmlrSupport }
		set_variable = { ENG_Region_Stab = 126.ENG_StateStats_Stability }
		add_to_variable = { ENG_Region_Stab = 127.ENG_StateStats_Stability }
		add_to_variable = { ENG_Region_Stab = 1300.ENG_StateStats_Stability }
		set_temp_variable = { ENG_region_setup_target = 1300 }
		ENG_region_setup = yes
	}

	# Do other SE OOB loading here as needed
	ENG_EnglishCivlWarOOBFENTank = yes
	ENG_EnglishCivlWarOperationStock = yes
	FEN = {
		load_oob = "ECW_Air_HMMLR"
		load_oob = "ECW_SAS"
		delete_unit_template_and_units = {
			division_template = "Disband"
			disband = yes
		}
		delete_unit_template_and_units = {
			division_template = "Disband Inf"
			disband = yes
		}
	}
	ENG = {
		load_oob = "ECW_Air_Collab"
		delete_unit_template_and_units = {
			division_template = "Disband"
			disband = yes
		}
		delete_unit_template_and_units = {
			division_template = "Disband Inf"
			disband = yes
		}
		if = {
			limit = { has_country_flag = ENG_use_the_blackshirts }
			load_oob = "ECW_Blackshirts"
		}
	}
	log = "[GetDateText]: [Root.GetName]: ENG_EnglishCivlWarOOB; Completed execution"
}

FEN_create_militia = {
	if = {
		limit = {
			check_variable = { FEN_stabperc = 0 }
		}
		FEN = {
			set_temp_variable = { just_manpower = FEN_mbat_count }
			multiply_temp_variable = { just_manpower = 4000 }
			add_manpower = var:just_manpower
		}
	}
	else = {
		meta_effect = {
			text = {
				create_unit = {
					division = "division_template = \"Militia\"	start_experience_factor = 0.25	start_equipment_factor = [FEN_eq]"
					owner = FEN
					allow_spawning_on_enemy_provs = yes
					count = FEN_mbat_count
				}
			}
			FEN_eq = "[?FEN_stabperc]"
		}
	}

}

ENG_create_militia = {
	if = {
		limit = {
			check_variable = { ENG_stabperc = 0 }
		}
		ENG = {
			set_temp_variable = { just_manpower = ENG_mbat_count }
			multiply_temp_variable = { just_manpower = 4000 }
			add_manpower = var:just_manpower
		}
	}
	else = {
		meta_effect = {
			text = {
				create_unit = {
					division = "division_template = \"Militia\"	start_experience_factor = 0.25	start_equipment_factor = [ENG_eq]"
					owner = ENG
					allow_spawning_on_enemy_provs = yes
					count = ENG_mbat_count
				}
			}
			ENG_eq = "[?ENG_stabperc]"
		}
	}

}

ENG_region_setup = {
	#if = {
	#	limit = {
	#		check_variable = { ENG_Region_Hmmlr_Support < 90 }
	#	}
	#	FEN = {
	#		add_manpower = 10000
	#		add_equipment_to_stockpile = { type = infantry_equipment amount = 400 producer = ENG }
	#		add_equipment_to_stockpile = { type = artillery_equipment amount = 20 producer = ENG }
	#		add_equipment_to_stockpile = { type = support_equipment amount = 28 producer = ENG }
	#		add_equipment_to_stockpile = { type = anti_tank_equipment amount = 45 producer = ENG }
	#	}
	#	ENG = {
	#		add_manpower = 30000
	#		add_equipment_to_stockpile = { type = infantry_equipment amount = 680 producer = ENG }
	#		add_equipment_to_stockpile = { type = artillery_equipment amount = 33 producer = ENG }
	#		add_equipment_to_stockpile = { type = support_equipment amount = 65 producer = ENG }
	#		add_equipment_to_stockpile = { type = anti_tank_equipment amount = 154 producer = ENG }
	#		add_equipment_to_stockpile = { type = motorized_equipment amount = 48 producer = ENG }
	#		add_equipment_to_stockpile = { type = IFV_equipment amount = 25 producer = ENG }
	#	}
	#}
	#else_if = {
	#	limit = {
	#		check_variable = { ENG_Region_Hmmlr_Support < 210 }
	#	}
	#	FEN = {
	#		add_manpower = 20000
	#		add_equipment_to_stockpile = { type = infantry_equipment amount = 540 producer = ENG }
	#		add_equipment_to_stockpile = { type = artillery_equipment amount = 26 producer = ENG }
	#		add_equipment_to_stockpile = { type = support_equipment amount = 30 producer = ENG }
	#		add_equipment_to_stockpile = { type = anti_tank_equipment amount = 98 producer = ENG }
	#	}
	#	ENG = {
	#		add_manpower = 20000
	#		add_equipment_to_stockpile = { type = infantry_equipment amount = 540 producer = ENG }
	#		add_equipment_to_stockpile = { type = artillery_equipment amount = 26 producer = ENG }
	#		add_equipment_to_stockpile = { type = support_equipment amount = 30 producer = ENG }
	#		add_equipment_to_stockpile = { type = anti_tank_equipment amount = 98 producer = ENG }
	#	}
	#}
	#else = {
	#	FEN = {
	#		add_manpower = 30000
	#		add_equipment_to_stockpile = { type = infantry_equipment amount = 680 producer = ENG }
	#		add_equipment_to_stockpile = { type = artillery_equipment amount = 33 producer = ENG }
	#		add_equipment_to_stockpile = { type = support_equipment amount = 65 producer = ENG }
	#		add_equipment_to_stockpile = { type = anti_tank_equipment amount = 154 producer = ENG }
	#		add_equipment_to_stockpile = { type = motorized_equipment amount = 48 producer = ENG }
	#		add_equipment_to_stockpile = { type = IFV_equipment amount = 25 producer = ENG }
	#	}
	#	ENG = {
	#		add_manpower = 10000
	#		add_equipment_to_stockpile = { type = infantry_equipment amount = 400 producer = ENG }
	#		add_equipment_to_stockpile = { type = artillery_equipment amount = 20 producer = ENG }
	#		add_equipment_to_stockpile = { type = support_equipment amount = 28 producer = ENG }
	#		add_equipment_to_stockpile = { type = anti_tank_equipment amount = 45 producer = ENG }
	#	}
	#}

	#spawn infantry divisions

	set_temp_variable = { ENG_region_stabperc = ENG_region_stab }
	divide_temp_variable = { ENG_region_stabperc = 100 }
	set_temp_variable = { FEN_region_stabperc = 1 }
	subtract_from_temp_variable = { FEN_region_stabperc = ENG_region_stabperc }

	set_temp_variable = { total_FEN_battalions = 20 }
	set_temp_variable = { FEN_ENG_ratio = ENG_Region_Hmmlr_Support }
	divide_temp_variable = { FEN_ENG_ratio = 300 }
	multiply_temp_variable = { total_FEN_battalions = FEN_ENG_ratio }
	round_temp_variable = total_FEN_battalions
	set_temp_variable = { total_ENG_battalions = 20 }
	subtract_from_temp_variable = { total_ENG_battalions = total_FEN_battalions }

	set_temp_variable = { FEN_to_disband = total_FEN_battalions }
	modulo_temp_variable = { FEN_to_disband = 6 }
	subtract_from_temp_variable = { total_FEN_battalions = FEN_to_disband }
	divide_temp_variable = { total_FEN_battalions = 6 }

	set_temp_variable = { ENG_to_disband = total_ENG_battalions }
	modulo_temp_variable = { ENG_to_disband = 6 }
	subtract_from_temp_variable = { total_ENG_battalions = ENG_to_disband }
	divide_temp_variable = { total_ENG_battalions = 6 }

	if = {
		limit = {
			check_variable = { ENG_Region_Hmmlr_Support < 150 }
		}
		random_state = {
			limit = {
				state = var:ENG_region_setup_target
			}
			meta_effect = {
				text = {
					create_unit = {
						division = "division_template = \"Motorized Division\"	start_experience_factor = 0.1	start_equipment_factor = [ENG_Eq]"
						owner = ENG
						allow_spawning_on_enemy_provs = yes
					}
				}
				ENG_eq = "[?ENG_region_stabperc]"
			}
		}
	}
	else = {
		random_state = {
			limit = {
				state = var:ENG_region_setup_target
			}
			meta_effect = {
				text = {
					create_unit = {
						division = "division_template = \"Motorized Division\"	start_experience_factor = 0.1	start_equipment_factor = [FEN_Eq]"
						owner = FEN
						allow_spawning_on_enemy_provs = yes
					}
				}
				FEN_eq = "[?FEN_region_stabperc]"
			}
		}
	}


	random_state = {
		limit = {
			state = var:ENG_region_setup_target
		}

		meta_effect = {
			text = {
				create_unit = {
					division = "division_template = \"Infantry Division\"	start_experience_factor = 0.3	start_equipment_factor = [FEN_Eq]"
					count = total_FEN_battalions
					owner = FEN
					allow_spawning_on_enemy_provs = yes
				}
			}
			FEN_eq = "[Get_FEN_Equipment_Ratio_R]"
		}

		meta_effect = {
			text = {
				create_unit = {
					division = "division_template = \"Disband Inf\"	start_experience_factor = 0.1	start_equipment_factor = [FEN_Eq]"
					count = FEN_to_disband
					owner = FEN
					allow_spawning_on_enemy_provs = yes
				}
			}
			FEN_eq = "[Get_FEN_Equipment_Ratio_R]"
		}
	}

	ENG = {
		random_state = {
			limit = {
				state = var:ENG_region_setup_target
			}
			meta_effect = {
				text = {
					create_unit = {
						division = "division_template = \"Infantry Division\"	start_experience_factor = 0.3	start_equipment_factor = [ENG_Eq]"
						count = total_ENG_battalions
						owner = ENG
						allow_spawning_on_enemy_provs = yes
					}
				}
				ENG_eq = "[Get_ENG_Equipment_Ratio_R]"
			}
			meta_effect = {
				text = {
					create_unit = {
						division = "division_template = \"Disband Inf\"	start_experience_factor = 0.1	start_equipment_factor = [ENG_Eq]"
						count = ENG_to_disband
						owner = ENG
						allow_spawning_on_enemy_provs = yes
					}
				}
				ENG_eq = "[Get_ENG_Equipment_Ratio_R]"
			}
		}
	}
}

ENG_EnglishCivlWarOOBFENTank = {
	log = "[GetDateText]: [Root.GetName]: ENG_EnglishCivlWarOOBFENTank; Executing"
	if = {
		limit = {
			is_ai = no
			has_country_flag = ENG_HMMLR_Tank_1
		}
		clr_country_flag = ENG_HMMLR_Tank_1
		if = {
			limit = { has_dlc = "No Step Back" }
			FEN = { load_oob = FEN_ECW_Tank_1_nsb }
		}
		if = {
			limit = { NOT = { has_dlc = "No Step Back" } }
			FEN = { load_oob = FEN_ECW_Tank_1 }
		}
	}
	else_if = {
		limit = {
			is_ai = yes
			has_country_flag = ENG_HMMLR_Tank_1
		}
		clr_country_flag = ENG_HMMLR_Tank_1
		FEN = {
			add_equipment_to_stockpile = { type = infantry_equipment_2 amount = 800 producer = USA }
			if = {
				limit = {
					has_dlc = "No Step Back"
				}
				load_oob = FEN_ECW_Tank_1_nsb
				add_equipment_to_stockpile = {
					type = MBT_chassis_2
					amount = 90
					producer = USA
				}
				add_equipment_to_stockpile = {
					type = APC_chassis_2
					amount = 100
					producer = USA
				}
			}
			else = {
				load_oob = FEN_ECW_Tank_1
				add_equipment_to_stockpile = {
					type = MBT_equipment_2
					amount = 90
					producer = USA
				}
				add_equipment_to_stockpile = {
					type = APC_equipment_2
					amount = 100
					producer = USA
				}
			}
			add_equipment_to_stockpile = { type = artillery_equipment_3 amount = 70 producer = USA }
			add_equipment_to_stockpile = { type = support_equipment amount = 100 producer = USA }
			add_manpower = 8400
		}
	}
	else_if = {
		limit = {
			has_country_flag = ENG_HMMLR_Tank_2
		}
		clr_country_flag = ENG_HMMLR_Tank_2
		if = {
			limit = { has_dlc = "No Step Back" }
			FEN = { load_oob = FEN_ECW_Tank_2_nsb }
		}
		if = {
			limit = { NOT = { has_dlc = "No Step Back" } }
			FEN = { load_oob = FEN_ECW_Tank_2 }
		}
	}
	else_if = {
		limit = {
			has_country_flag = ENG_HMMLR_Tank_3
		}
		clr_country_flag = ENG_HMMLR_Tank_3
		FEN = {
			add_equipment_to_stockpile = { type = infantry_equipment_2 amount = 300 producer = USA }
			if = {
				limit = {
					has_dlc = "No Step Back"
				}
				load_oob = FEN_ECW_Tank_3_nsb
				add_equipment_to_stockpile = {
					type = MBT_chassis_2
					amount = 36
					producer = USA
				}
				add_equipment_to_stockpile = {
					type = APC_chassis_2
					amount = 40
					producer = USA
				}
			}
			else = {
				load_oob = FEN_ECW_Tank_3
				add_equipment_to_stockpile = {
					type = MBT_equipment_2
					amount = 36
					producer = USA
				}
				add_equipment_to_stockpile = {
					type = APC_equipment_2
					amount = 40
					producer = USA
				}
			}
			add_equipment_to_stockpile = { type = artillery_equipment_3 amount = 24 producer = USA }
			add_equipment_to_stockpile = { type = support_equipment amount = 35 producer = USA }
		}
	}
	else_if = {
		limit = {
			has_country_flag = Hmmlr_special_shipments_approved
		}
		FEN = {
			add_equipment_to_stockpile = { type = infantry_equipment_2 amount = 300 producer = USA }
			if = {
				limit = {
					has_dlc = "No Step Back"
				}
				add_equipment_to_stockpile = {
					type = MBT_chassis_2
					amount = 36
					producer = USA
				}
				add_equipment_to_stockpile = {
					type = APC_chassis_2
					amount = 40
					producer = USA
				}
			}
			else = {
				add_equipment_to_stockpile = {
					type = MBT_equipment_2
					amount = 36
					producer = USA
				}
				add_equipment_to_stockpile = {
					type = APC_equipment_2
					amount = 40
					producer = USA
				}
			}
			add_equipment_to_stockpile = { type = artillery_equipment_3 amount = 24 producer = USA }
			add_equipment_to_stockpile = { type = support_equipment amount = 35 producer = USA }
		}
	}
	clr_country_flag = Hmmlr_special_shipment_1
	clr_country_flag = Hmmlr_special_shipment_2
	clr_country_flag = Hmmlr_special_shipment_3
	clr_country_flag = Hmmlr_special_shipments_approved
	log = "[GetDateText]: [Root.GetName]: ENG_EnglishCivlWarOOBFENTank; Completed execution"
}

ENG_EnglishCivlWarOperationStock = {
	log = "[GetDateText]: [Root.GetName]: ENG_EnglishCivlWarArmoryRaids; Executing"
	if = {
		limit = {
			has_country_flag = ENG_operation_stock_success
		}
		clr_country_flag = ENG_operation_stock_success
		FEN = {
			add_equipment_to_stockpile = { type = anti_tank_equipment_0 amount = 200 producer = ENG }
			if = {
				limit = {
					has_dlc = "No Step Back"
				}
				add_equipment_to_stockpile = {
					type = MBT_chassis_1
					amount = 30
					producer = GER
				}
			}
			else = {
				add_equipment_to_stockpile = {
					type = MBT_equipment_1
					amount = 30
					producer = GER
				}
			}
			add_equipment_to_stockpile = { type = artillery_equipment_2 amount = 20 producer = GER }
			add_equipment_to_stockpile = { type = support_equipment amount = 50 producer = ENG }
		}
	}
	else_if = {
		limit = {
			has_country_flag = ENG_operation_stock_partial
		}
		clr_country_flag = ENG_operation_stock_partial
		FEN = {
			add_equipment_to_stockpile = { type = anti_tank_equipment_0 amount = 100 producer = ENG }
			add_equipment_to_stockpile = { type = support_equipment amount = 25 producer = ENG }
		}
	}
	log = "[GetDateText]: [Root.GetName]: ENG_EnglishCivlWarArmoryRaids; Completed execution"
}


####### ECW Completion Effects #######

ENG_HMMLR_ECW_VictoryPreAnnex = {
	log = "[GetDateText]: [Root.GetName]: ENG_HMMLR_ECW_VictoryPreAnnex; Executing"
	#This SE contains effects that are to be done before FEN is annexed into ENG
	hidden_effect = {

		#Fix debtplosion
		ENG = {
			set_variable = { national_debt = FEN.national_debt }
			fiscal_crisis_check = yes
		}

		#Switch player tag
		custom_effect_tooltip = GER_fix_your_shit_pdx_again
		ENG = { change_tag_from = FEN }

		#Shift FEN politics to ENG
		ENG = {
			set_party_name = {
				ideology = paternalism
				long_name = ENG_HMMLR_Reconstruction_Conservative_long
				name = ENG_HMMLR_Reconstruction_Conservative
			}
			set_party_name = {
				ideology = conservatism
				long_name = ENG_HMMLR_Reconstruction_Moderate_long
				name = ENG_HMMLR_Reconstruction_Moderate
			}
			set_party_name = {
				ideology = liberalism
				long_name = ENG_HMMLR_Reconstruction_Liberal_long
				name = ENG_HMMLR_Reconstruction_Liberal
			}
			set_party_name = {
				ideology = progressivism
				long_name = ENG_HMMLR_Reconstruction_Social_Long
				name = ENG_HMMLR_Reconstruction_Social
			}
			set_party_name = {
				ideology = socialist
				long_name = ENG_HMMLR_Reconstruction_Reformist_long
				name = ENG_HMMLR_Reconstruction_Reformist
			}
			set_party_name = {
				ideology = communist
				long_name = ENG_HMMLR_Reconstruction_Hardliner_long
				name = ENG_HMMLR_Reconstruction_Hardliner
			}
			set_party_name = {
				ideology = despotism
				long_name = ENG_HMMLR_Reconstruction_Movement_long
				name = ENG_HMMLR_Reconstruction_Movement
			}
			set_party_name = {
				ideology = fascism
				long_name = ENG_HMMLR_Reconstruction_Fascist_long
				name = ENG_HMMLR_Reconstruction_Fascist
			}
			retire_ideology_leader = conservatism		#Macmillan
			retire_ideology_leader = liberal_conservatism			#Maudling
			set_politics = { ruling_party = paternalism }
			retire_country_leader = yes

			#Removes Collab Military Leaders
			every_unit_leader = {
				retire = yes
			}

			FEN = { #Moving all characters to ENG
				every_character = {
					limit = {
						NOT = {
							is_character = FEN_Generic_Vacant
							is_character = FEN_Heinrich_HMMLR
							is_character = FEN_Harold_Wilson #Old Content
							is_character = FEN_Jeffrey_Hamm #Old Content
						}
					}
					set_nationality = ENG
				}
			}
			remove_country_leader_role = {
				character = FEN_Bill_Alexander # optional if inside character scope
				ideology = communist_subtype
			}
			add_country_leader_role = {
				character = FEN_Bill_Alexander # optional if inside character scope
				promote_leader = yes
				country_leader = {
					desc = "POLITICS_WILLIAM_ALEXANDER_DESC"
					ideology = socialist_subtype
					expire = "1999.1.1"
					id = -1
				}
			}
			add_country_leader_role = {
				character = ENG_Harold_Wilson
				promote_leader = yes
				country_leader = {
					desc = "POLITICS_HAROLD_WILSON_DESC_OLD"
					ideology = socialist_revolutionary_frontism_subtype
					expire = "1999.1.1"
					id = -1
				}
			}
			ENG_Harold_Wilson = {
				set_portraits = {
					civilian = { large = "gfx/leaders/ENG/Portrait_Britain_Harold_Wilson.dds" }
				}
			}
			add_country_leader_role = {
				character = ENG_Jeffrey_Hamm
				promote_leader = yes
				country_leader = {
					ideology = fascism_subtype
					expire = "1999.1.1"
					id = -1
				}
			}
			promote_character = FEN_Reg_Birch
			promote_character = FEN_Claude_Auchinleck
			promote_character = FEN_David_Stirling
			promote_character = FEN_Norman_St_John_Stevas
			promote_character = FEN_George_Jellicoe

			set_popularities = {
				paternalism = 25
				conservatism = 15
				liberalism = 13
				progressivism = 5
				socialist = 27
				communist = 10
				fascism = 5
			}
			#Remove ENG-exclusive ideas
			remove_ideas = {
				ENG_Brutal_War
				ENG_Brutal_War_AI
				ENG_the_legitimate_government
				ENG_promises_of_change
				ENG_a_force_of_darkness
				ENG_attacks_behind_lines
				TNO_ParliamentMechanic_Monarch_Edward_VIII
				TNO_ParliamentMechanic_OppLeader_Harold_Macmillan
				TNO_ParliamentMechanic_Speaker_Alec_Douglas_Home
			}
			ENG = {
				if = {
					limit = {
						has_dynamic_modifier = {
							modifier = ENG_DYNMON_english_army
						}
					}
					remove_dynamic_modifier = { modifier = ENG_DYNMON_english_army }
				}
			}
			add_ideas = {
				#ENG_growing_hunger
				ENG_promising_future
				#FEN_Food_Insecurity
			}
			TNO_Britain_ElectionSeason_Initialize_Post_ECW_HMMLR = yes
			TNO_Britain_ElectionSeason_Initialize_Cornwall_HMMLR = yes
			remove_ideas = {
				tno_trade_unions_illegal
				tno_racial_integration_none
				tno_minorities_oppression
				tno_admin_efficiency_deficient_administrative_systems
				tno_penal_system_harsh_penal_code
			}
			#Joins the American Economic Sphere
			econ_join_sphere_USA = yes
			remove_all_ministers = yes
			add_ideas = {
				### MINISTERS ###
				FEN_Claude_Auchinleck_hog
				FEN_David_Stirling_sec
				FEN_Bill_Alexander_for
				FEN_Reg_Birch_eco

				### POLITICAL ###
				tno_trade_unions_state_controlled

				### MILITARY ###
				tno_women_military_assistance
				tno_racial_integration_integrated_military

				### Econimics ###
				tno_unemployment_trinket_subsidies

				### SOCIAL ###
				tno_minorities_equal_rights
				tno_penal_system_incarceration

				### SOCDEV ###
				tno_admin_efficiency_functional_administrative_systems
			}

			### Set Policy Effectiveness

			### Political
			set_variable = { tno_political_parties_effectiveness = 60 }
			set_variable = { tno_religious_rights_effectiveness = 80 }
			set_variable = { tno_trade_unions_effectiveness = 85 }
			set_variable = { tno_immigration_effectiveness = 90 }
			set_variable = { tno_slavery_effectiveness = 100 }
			set_variable = { tno_public_meetings_effectiveness = 60 }
			set_variable = { tno_press_rights_effectiveness = 65 }
			set_variable = { tno_vote_franchise_effectiveness = 70 }

			### Military
			set_variable = { tno_conscription_effectiveness = 100 }
			set_variable = { tno_military_supervision_effectiveness = 100 }
			set_variable = { tno_training_effectiveness = 80 }
			set_variable = { tno_draft_exemptions_effectiveness = 85 }

			### Economic
			set_variable = { tno_trade_laws_effectiveness = 85 }
			set_variable = { tno_income_taxation_effectiveness = 70 }
			set_variable = { tno_minimum_wage_effectiveness = 65 }
			set_variable = { tno_max_workhours_effectiveness = 85 }
			set_variable = { tno_pensions_effectiveness = 75 }
			set_variable = { tno_unemployment_effectiveness = 100 }


			### Social
			set_variable = { tno_health_care_effectiveness = 75 }
			set_variable = { tno_education_effectiveness = 65 }
			set_variable = { tno_penal_system_effectiveness = 75 }
			set_variable = { tno_gender_rights_effectiveness = 85 }
			set_variable = { tno_security_effectiveness = 55 }
			set_variable = { tno_regulations_effectiveness = 90 }


			#Remove ENG divisions
			ENG = {
				division_template = {
					name = "Garrison Division"
					division_names_group = FEN_GarrisonDivision

					regiments = {
						cavalry = { x = 0 y = 0 }
						cavalry = { x = 0 y = 1 }
						cavalry = { x = 1 y = 0 }
						cavalry = { x = 1 y = 1 }
					}
					support = {
						military_police = { x = 0 y = 0 }
					}
				}
				delete_unit_template_and_units = {
					division_template = "Royal Military Police"
				}
				delete_unit_template_and_units = {
					division_template = "Militia"
				}
				delete_unit_template_and_units = {
					division_template = "Motorized Division"
				}
				delete_unit_template_and_units = {
					division_template = "Infantry Division"
				}
				inherit_technology = FEN
			}

			#Set flags
			set_cosmetic_tag = ENG_HMMLR_Reconstruction
		}
		#Remove anti-OFN opinion modifiers
		USA = { ENG = { clear_embargo_PREV = yes } }
		CAN = { ENG = { clear_embargo_PREV = yes } }
		AST = { ENG = { clear_embargo_PREV = yes } }
		GUY = { ENG = { clear_embargo_PREV = yes } }
		NZL = { ENG = { clear_embargo_PREV = yes } }
		ICE = { ENG = { clear_embargo_PREV = yes } }
		BLZ = { ENG = { clear_embargo_PREV = yes } }

		#Add anti-Pakt opinion modifiers
		GER = { ENG = { set_embargo_PREV = yes } }
		GGR = { ENG = { set_embargo_PREV = yes } }
		BGR = { ENG = { set_embargo_PREV = yes } }
		GGR = { ENG = { set_embargo_PREV = yes } }
		SGR = { ENG = { set_embargo_PREV = yes } }
		CZE = { ENG = { set_embargo_PREV = yes } }
		GGN = { ENG = { set_embargo_PREV = yes } }
		SLO = { ENG = { set_embargo_PREV = yes } }
		UKR = { ENG = { set_embargo_PREV = yes } }
		MCW = { ENG = { set_embargo_PREV = yes } }
		OST = { ENG = { set_embargo_PREV = yes } }
		COG = { ENG = { set_embargo_PREV = yes } }
		CAU = { ENG = { set_embargo_PREV = yes } }
		SER = { ENG = { set_embargo_PREV = yes } }
		DEN = { ENG = { set_embargo_PREV = yes } }
		HOL = { ENG = { set_embargo_PREV = yes } }
		NOR = { ENG = { set_embargo_PREV = yes } }
		MAD = { ENG = { set_embargo_PREV = yes } }
		GRO = { ENG = { set_embargo_PREV = yes } }
		ANG = { ENG = { set_embargo_PREV = yes } }
		BRG = { ENG = { set_embargo_PREV = yes } }
		BUL = { ENG = { set_embargo_PREV = yes } }
		FRA = { ENG = { set_embargo_PREV = yes } }
		IRE = { ENG = { set_embargo_PREV = yes } }
	}
	log = "[GetDateText]: [Root.GetName]: ENG_HMMLR_ECW_VictoryPreAnnex; Completed execution"
}

####### Macmillan Stuff ######

ENG_MacmillanSetVariables = {
	set_variable = { ENG_Mac_Lovers = 0.70 }
	set_variable = { ENG_Lib_Lovers = 0.30 }
	set_variable = { ENG_democratization_process = 10 }
}

ENG_Thatcher_Add_Maggie_Party_Support_1 = {
	add_to_variable = {
		var = ENG_Maggie_Party_Lead
		value = 0.01
	}
	clamp_variable = {
		var = ENG_Maggie_Party_Lead
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_OG_Party_Lead
		value = -0.01
	}
	clamp_variable = {
		var = ENG_OG_Party_Lead
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	custom_effect_tooltip = ENG_DEC_Maggie_Party_Gain_1_tt
}

ENG_Thatcher_Add_Maggie_Party_Support_3 = {
	add_to_variable = {
		var = ENG_Maggie_Party_Lead
		value = 0.03
	}
	clamp_variable = {
		var = ENG_Maggie_Party_Lead
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_OG_Party_Lead
		value = -0.03
	}
	clamp_variable = {
		var = ENG_OG_Party_Lead
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	custom_effect_tooltip = ENG_DEC_Maggie_Party_Gain_3_tt
}

ENG_Thatcher_Add_Maggie_Party_Support_5 = {
	add_to_variable = {
		var = ENG_Maggie_Party_Lead
		value = 0.05
	}
	clamp_variable = {
		var = ENG_Maggie_Party_Lead
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_OG_Party_Lead
		value = -0.05
	}
	clamp_variable = {
		var = ENG_OG_Party_Lead
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	custom_effect_tooltip = ENG_DEC_Maggie_Party_Gain_5_tt
}

ENG_Thatcher_Add_Maggie_Party_Support_10 = {
	add_to_variable = {
		var = ENG_Maggie_Party_Lead
		value = 0.10
	}
	clamp_variable = {
		var = ENG_Maggie_Party_Lead
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_OG_Party_Lead
		value = -0.10
	}
	clamp_variable = {
		var = ENG_OG_Party_Lead
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	custom_effect_tooltip = ENG_DEC_Maggie_Party_Gain_10_tt
}

ENG_Thatcher_Add_OG_Party_Support_1 = {
	add_to_variable = {
		var = ENG_OG_Party_Lead
		value = 0.01
	}
	clamp_variable = {
		var = ENG_OG_Party_Lead
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Maggie_Party_Lead
		value = -0.01
	}
	clamp_variable = {
		var = ENG_Maggie_Party_Lead
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	custom_effect_tooltip = ENG_DEC_OG_Party_Gain_1_tt
}

ENG_Thatcher_Add_OG_Party_Support_3 = {
	add_to_variable = {
		var = ENG_OG_Party_Lead
		value = 0.03
	}
	clamp_variable = {
		var = ENG_OG_Party_Lead
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Maggie_Party_Lead
		value = -0.03
	}
	clamp_variable = {
		var = ENG_Maggie_Party_Lead
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	custom_effect_tooltip = ENG_DEC_OG_Party_Gain_3_tt
}

ENG_Thatcher_Add_OG_Party_Support_5 = {
	add_to_variable = {
		var = ENG_OG_Party_Lead
		value = 0.05
	}
	clamp_variable = {
		var = ENG_OG_Party_Lead
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Maggie_Party_Lead
		value = -0.05
	}
	clamp_variable = {
		var = ENG_Maggie_Party_Lead
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	custom_effect_tooltip = ENG_DEC_OG_Party_Gain_5_tt
}

ENG_Thatcher_Add_OG_Party_Support_10 = {
	add_to_variable = {
		var = ENG_OG_Party_Lead
		value = 0.10
	}
	clamp_variable = {
		var = ENG_OG_Party_Lead
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Maggie_Party_Lead
		value = -0.10
	}
	clamp_variable = {
		var = ENG_Maggie_Party_Lead
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	custom_effect_tooltip = ENG_DEC_OG_Party_Gain_10_tt
}

ENG_Macmillan_Add_Liberal_Love_1 = {
	add_to_variable = {
		var = ENG_Lib_Lovers
		value = 0.01
	}
	clamp_variable = {
		var = ENG_Lib_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Mac_Lovers
		value = -0.01
	}
	clamp_variable = {
		var = ENG_Mac_Lovers
		min = 0
		max = 1
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Liberal_Gain_1_tt
	hidden_effect = {
		UE_INNER_POLITICS_CALC = yes
	}
}

ENG_Macmillan_Add_Liberal_Love_3 = {
	add_to_variable = {
		var = ENG_Lib_Lovers
		value = 0.03
	}
	clamp_variable = {
		var = ENG_Lib_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Mac_Lovers
		value = -0.03
	}
	clamp_variable = {
		var = ENG_Mac_Lovers
		min = 0
		max = 1
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Liberal_Gain_3_tt
	hidden_effect = {
		UE_INNER_POLITICS_CALC = yes
	}
}

ENG_Macmillan_Add_Liberal_Love_5 = {
	add_to_variable = {
		var = ENG_Lib_Lovers
		value = 0.05
	}
	clamp_variable = {
		var = ENG_Lib_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Mac_Lovers
		value = -0.05
	}
	clamp_variable = {
		var = ENG_Mac_Lovers
		min = 0
		max = 1
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Liberal_Gain_5_tt
	hidden_effect = {
		UE_INNER_POLITICS_CALC = yes
	}
}

ENG_Macmillan_Add_Liberal_Love_10 = {
	add_to_variable = {
		var = ENG_Lib_Lovers
		value = 0.10
	}
	clamp_variable = {
		var = ENG_Lib_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Mac_Lovers
		value = -0.10
	}
	clamp_variable = {
		var = ENG_Mac_Lovers
		min = 0
		max = 1
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Liberal_Gain_10_tt
	hidden_effect = {
		UE_INNER_POLITICS_CALC = yes }
}

ENG_Macmillan_Add_Mac_Love_1 = {
	add_to_variable = {
		var = ENG_Mac_Lovers
		value = 0.01
	}
	clamp_variable = {
		var = ENG_Mac_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Lib_Lovers
		value = -0.01
	}
	clamp_variable = {
		var = ENG_Lib_Lovers
		min = 0
		max = 1
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Mac_Gain_1_tt
	hidden_effect = {
		UE_INNER_POLITICS_CALC = yes
	}
}

ENG_Macmillan_Add_Mac_Love_3 = {
	add_to_variable = {
		var = ENG_Mac_Lovers
		value = 0.03
	}
	clamp_variable = {
		var = ENG_Mac_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Lib_Lovers
		value = -0.03
	}
	clamp_variable = {
		var = ENG_Lib_Lovers
		min = 0
		max = 1
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Mac_Gain_3_tt
	hidden_effect = {
		UE_INNER_POLITICS_CALC = yes
	}
}

ENG_Macmillan_Add_Mac_Love_5 = {
	add_to_variable = {
		var = ENG_Mac_Lovers
		value = 0.05
	}
	clamp_variable = {
		var = ENG_Mac_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Lib_Lovers
		value = -0.05
	}
	clamp_variable = {
		var = ENG_Lib_Lovers
		min = 0
		max = 1
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Mac_Gain_5_tt
	hidden_effect = {
		UE_INNER_POLITICS_CALC = yes
	}
}

ENG_Macmillan_Add_Mac_Love_10 = {
	add_to_variable = {
		var = ENG_Mac_Lovers
		value = 0.10
	}
	clamp_variable = {
		var = ENG_Mac_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Lib_Lovers
		value = -0.10
	}
	clamp_variable = {
		var = ENG_Lib_Lovers
		min = 0
		max = 1
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Mac_Gain_10_tt
	hidden_effect = {
		UE_INNER_POLITICS_CALC = yes
	}
}

ENG_Macmillan_Add_Democratization_1 = {
	add_to_variable = { ENG_democratization_process = 1 }
	clamp_variable = {
		var = ENG_democratization_process
		min = 0
		max = 100
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_Macmillan_Add_Democratization_1_tt
}

ENG_Macmillan_Add_Democratization_3 = {
	add_to_variable = { ENG_democratization_process = 3 }
	clamp_variable = {
		var = ENG_democratization_process
		min = 0
		max = 100
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_Macmillan_Add_Democratization_3_tt
}

ENG_Macmillan_Add_Democratization_5 = {
	add_to_variable = { ENG_democratization_process = 5 }
	clamp_variable = {
		var = ENG_democratization_process
		min = 0
		max = 100
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_Macmillan_Add_Democratization_5_tt
}

ENG_Macmillan_Add_Democratization_10 = {
	add_to_variable = { ENG_democratization_process = 10 }
	clamp_variable = {
		var = ENG_democratization_process
		min = 0
		max = 100
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_Macmillan_Add_Democratization_10_tt
}

ENG_Macmillan_Remove_Democratization_1 = {
	subtract_from_variable = { ENG_democratization_process = 1 }
	clamp_variable = {
		var = ENG_democratization_process
		min = 0
		max = 100
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_Macmillan_Remove_Democratization_1_tt
}

ENG_Macmillan_Remove_Democratization_3 = {
	subtract_from_variable = { ENG_democratization_process = 3 }
	clamp_variable = {
		var = ENG_democratization_process
		min = 0
		max = 100
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_Macmillan_Remove_Democratization_3_tt
}

ENG_Macmillan_Remove_Democratization_5 = {
	subtract_from_variable = { ENG_democratization_process = 5 }
	clamp_variable = {
		var = ENG_democratization_process
		min = 0
		max = 100
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_Macmillan_Remove_Democratization_5_tt
}

ENG_Macmillan_Remove_Democratization_10 = {
	subtract_from_variable = { ENG_democratization_process = 10 }
	clamp_variable = {
		var = ENG_democratization_process
		min = 0
		max = 100
	}
	MAC_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_Macmillan_Remove_Democratization_10_tt
}

####### Thatcher Stuff #######

ENG_ThatcherSetVariables = {
	if = {
		limit = {
			ENG = {
				is_ai = yes
			}
		}
		set_variable = { ENG_Maggie_Party_Lead = 0.30 }
		set_variable = { ENG_OG_Party_Lead = 0.70 }
		set_variable = { ENG_Elite_Lovers = 0.60 }
		set_variable = { ENG_Populist_Lovers = 0.60 }
	}
	else = {
		set_variable = { ENG_Maggie_Party_Lead = 0.25 }
		set_variable = { ENG_OG_Party_Lead = 0.75 }
		set_variable = { ENG_Elite_Lovers = 0.40 }
		set_variable = { ENG_Populist_Lovers = 0.40 }
	}
}

ENG_Thatcher_Add_Elite_Love_1 = {
	add_to_variable = {
		var = ENG_Elite_Lovers
		value = 0.01
	}
	clamp_variable = {
		var = ENG_Elite_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Populist_Lovers
		value = 0.00
	}
	clamp_variable = {
		var = ENG_Populist_Lovers
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	hidden_effect = {
		RP_ELITE_SPLIT_CALC = yes
		RP_POP_SPLIT_CALC = yes
	}
	custom_effect_tooltip = ENG_DEC_Elite_Gain_1_tt
}

ENG_Thatcher_Add_Elite_Love_3 = {
	add_to_variable = {
		var = ENG_Elite_Lovers
		value = 0.025
	}
	clamp_variable = {
		var = ENG_Elite_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Populist_Lovers
		value = -0.01
	}
	clamp_variable = {
		var = ENG_Populist_Lovers
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	hidden_effect = {
		RP_ELITE_SPLIT_CALC = yes
		RP_POP_SPLIT_CALC = yes
	}
	custom_effect_tooltip = ENG_DEC_Elite_Gain_3_tt
}

ENG_Thatcher_Add_Elite_Love_3_CIA = {
	add_to_variable = {
		var = ENG_Elite_Lovers
		value = 0.03
	}
	clamp_variable = {
		var = ENG_Elite_Lovers
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	hidden_effect = {
		RP_ELITE_SPLIT_CALC = yes
		RP_POP_SPLIT_CALC = yes
	}
	custom_effect_tooltip = ENG_DEC_Elite_Gain_3_CIA_tt
}

ENG_Thatcher_Add_Elite_Love_5 = {
	add_to_variable = {
		var = ENG_Elite_Lovers
		value = 0.05
	}
	clamp_variable = {
		var = ENG_Elite_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Populist_Lovers
		value = -0.03
	}
	clamp_variable = {
		var = ENG_Populist_Lovers
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	hidden_effect = {
		RP_ELITE_SPLIT_CALC = yes
		RP_POP_SPLIT_CALC = yes
	}
	custom_effect_tooltip = ENG_DEC_Elite_Gain_5_tt
	custom_effect_tooltip = ENG_DEC_Populists_Lose_3_tt
}

ENG_Thatcher_Add_Elite_Love_10 = {
	add_to_variable = {
		var = ENG_Elite_Lovers
		value = 0.10
	}
	clamp_variable = {
		var = ENG_Elite_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Populist_Lovers
		value = -0.075
	}
	clamp_variable = {
		var = ENG_Populist_Lovers
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	hidden_effect = {
		RP_ELITE_SPLIT_CALC = yes
		RP_POP_SPLIT_CALC = yes
	}
	custom_effect_tooltip = ENG_DEC_Elite_Gain_10_tt
}

ENG_Thatcher_Add_Pop_Love_1 = {
	add_to_variable = {
		var = ENG_Populist_Lovers
		value = 0.01
	}
	clamp_variable = {
		var = ENG_Populist_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Elite_Lovers
		value = 0.00
	}
	clamp_variable = {
		var = ENG_Elite_Lovers
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	hidden_effect = {
		RP_ELITE_SPLIT_CALC = yes
		RP_POP_SPLIT_CALC = yes
	}
	custom_effect_tooltip = ENG_DEC_Populists_Gain_1_tt
}

ENG_Thatcher_Add_Pop_Love_3 = {
	add_to_variable = {
		var = ENG_Populist_Lovers
		value = 0.025
	}
	clamp_variable = {
		var = ENG_Populist_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Elite_Lovers
		value = -0.01
	}
	clamp_variable = {
		var = ENG_Elite_Lovers
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	hidden_effect = {
		RP_ELITE_SPLIT_CALC = yes
		RP_POP_SPLIT_CALC = yes
	}
	custom_effect_tooltip = ENG_DEC_Populists_Gain_3_tt
}

ENG_Thatcher_Add_Pop_Love_3_CIA = {
	add_to_variable = {
		var = ENG_Populist_Lovers
		value = 0.03
	}
	clamp_variable = {
		var = ENG_Populist_Lovers
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	hidden_effect = {
		RP_ELITE_SPLIT_CALC = yes
		RP_POP_SPLIT_CALC = yes
	}
	custom_effect_tooltip = ENG_DEC_Populists_Gain_3_CIA_tt
}

ENG_Thatcher_Add_Pop_Love_5 = {
	add_to_variable = {
		var = ENG_Populist_Lovers
		value = 0.05
	}
	clamp_variable = {
		var = ENG_Populist_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Elite_Lovers
		value = -0.03
	}
	clamp_variable = {
		var = ENG_Elite_Lovers
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	hidden_effect = {
		RP_ELITE_SPLIT_CALC = yes
		RP_POP_SPLIT_CALC = yes
	}
	custom_effect_tooltip = ENG_DEC_Populists_Gain_5_tt
	custom_effect_tooltip = ENG_DEC_Elite_Lose_3_tt
}

ENG_Thatcher_Add_Pop_Love_10 = {
	add_to_variable = {
		var = ENG_Populist_Lovers
		value = 0.10
	}
	clamp_variable = {
		var = ENG_Populist_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Elite_Lovers
		value = -0.075
	}
	clamp_variable = {
		var = ENG_Elite_Lovers
		min = 0
		max = 1
	}
	ENG_something_bad_maggie = yes
	hidden_effect = {
		RP_ELITE_SPLIT_CALC = yes
		RP_POP_SPLIT_CALC = yes
	}
	custom_effect_tooltip = ENG_DEC_Populists_Gain_10_tt
}

ENG_Thatcher_Tick = {
	if = {
		limit = {
			ENG = {
				has_country_leader = {
					character = ENG_Margaret_Thatcher
					ruling_only = yes
				}
			}
		}
		ENG = {
			set_variable = { Thatcher_Influence_Monthly = 0 }
			if = {
				limit = {
					check_variable = {
						var = ENG_Populist_Lovers
						value = 0.4
						compare = less_than
					}
				}
				subtract_from_variable = { Thatcher_Influence_Monthly = 0.01 }
				if = {
					limit = {
						check_variable = {
							var = ENG_Populist_Lovers
							value = 0.2
							compare = less_than
						}
					}
					subtract_from_variable = { Thatcher_Influence_Monthly = 0.01 }
				}
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Populist_Lovers
						value = 0.6
						compare = greater_than
					}
				}
				add_to_variable = { Thatcher_Influence_Monthly = 0.005 }
				if = {
					limit = {
						check_variable = {
							var = ENG_Populist_Lovers
							value = 0.8
							compare = greater_than
						}
					}
					add_to_variable = { Thatcher_Influence_Monthly = 0.005 }
				}
			}
			if = {
				limit = {
					check_variable = {
						var = ENG_Elite_Lovers
						value = 0.4
						compare = less_than
					}
				}
				subtract_from_variable = { Thatcher_Influence_Monthly = 0.01 }
				if = {
					limit = {
						check_variable = {
							var = ENG_Elite_Lovers
							value = 0.2
							compare = less_than
						}
					}
					subtract_from_variable = { Thatcher_Influence_Monthly = 0.01 }
				}
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Elite_Lovers
						value = 0.6
						compare = greater_than
					}
				}
				add_to_variable = { Thatcher_Influence_Monthly = 0.005 }
				if = {
					limit = {
						check_variable = {
							var = ENG_Elite_Lovers
							value = 0.8
							compare = greater_than
						}
					}
					add_to_variable = { Thatcher_Influence_Monthly = 0.005 }
				}
			}
			add_to_variable = { ENG_Maggie_Party_Lead = Thatcher_Influence_Monthly }
			subtract_from_variable = { ENG_OG_Party_Lead = Thatcher_Influence_Monthly }

			set_temp_variable = { TEMP_MAGGIE_FOR_GUI = ENG_Maggie_Party_Lead }
			multiply_temp_variable = { TEMP_MAGGIE_FOR_GUI = 100 }
			set_variable = { MAGGIE_FOR_GUI = TEMP_MAGGIE_FOR_GUI }

			set_temp_variable = { TEMP_Thatcher_Influence_Monthly_FOR_GUI = Thatcher_Influence_Monthly }
			multiply_temp_variable = { TEMP_Thatcher_Influence_Monthly_FOR_GUI = 100 }
			set_variable = { Thatcher_Influence_Monthly_FOR_GUI = TEMP_Thatcher_Influence_Monthly_FOR_GUI }
		}
	}
}


ENG_something_bad_maggie = {
	set_temp_variable = { TEMP_MAGGIE_FOR_GUI = ENG_Maggie_Party_Lead }
	multiply_temp_variable = { TEMP_MAGGIE_FOR_GUI = 100 }
	set_variable = { MAGGIE_FOR_GUI = TEMP_MAGGIE_FOR_GUI }
}

SLP_GUI_REFRESH = {
	set_temp_variable = { TEMP_REFORM_BAR = ENG_SLPReformation_process }
	multiply_temp_variable = { TEMP_REFORM_BAR = 100 }
	set_variable = { ENG_REFORM_SLP = TEMP_REFORM_BAR }
	set_temp_variable = { TEMP_SLP_LOVER = ENG_Reformers_SLP_Lovers }
	multiply_temp_variable = { TEMP_SLP_LOVER = 100 }
	set_variable = { ENG_SLP_GOOD_GUYS = TEMP_SLP_LOVER }
}
MAC_GUI_REFRESH = {
	set_temp_variable = { TEMP_MAC_LOVER_BAR = ENG_Mac_Lovers }
	multiply_temp_variable = { TEMP_MAC_LOVER_BAR = 100 }
	set_variable = { ENG_MAC_LOVER_BAR = TEMP_MAC_LOVER_BAR }
	set_temp_variable = { TEMP_DEMO_BAR = ENG_Mac_Lovers }
	multiply_temp_variable = { TEMP_DEMO_BAR = 100 }
	set_variable = { ENG_MAC_DEMO_BAR = ENG_democratization_process }
}

ENG_Democratization_Tick = {
	if = {
		limit = {
			ENG = {
				has_country_flag = ENG_not_in_game_yet
			}
		}
		ENG = {
			if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.05
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = 0.10
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_gain_10_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.05
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.10
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = 0.09
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_gain_9_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.10
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.15
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = 0.08
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_gain_8_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.15
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.20
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = 0.07
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_gain_7_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.20
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.25
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = 0.06
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_gain_6_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.25
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.30
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = 0.05
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_gain_5_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.30
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.35
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = 0.04
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_gain_4_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.35
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.40
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = 0.03
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_gain_3_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.40
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.45
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = 0.02
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_gain_2_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.45
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.50
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = 0.01
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_gain_1_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.50
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.55
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = -0.01
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_lose_1_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.55
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.60
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = -0.02
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_lose_2_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.60
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.65
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = -0.03
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_lose_3_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.65
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.70
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = -0.04
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_lose_4_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.70
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.75
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = -0.05
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_lose_5_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.75
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.80
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = -0.06
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_lose_6_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.80
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.85
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = -0.07
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_lose_7_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.85
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.90
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = -0.08
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_lose_8_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.90
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Mac_Lovers
							value = 0.95
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = -0.09
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_lose_9_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Mac_Lovers
						value = 0.95
						compare = greater_than_or_equals
					}
				}
				add_to_variable = {
					var = ENG_democratization_process
					value = -0.10
				}
				clamp_variable = {
					var = ENG_democratization_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_Democratization_lose_10_tt
			}
		}
	}
	MAC_GUI_REFRESH = yes
}

## NDL MECHANIC

ENG_NDL_MEC_Begin_Liberal_Tick = {
	add_to_variable = { ENG_NDL_Mec_Liberal_Strength = 0.02 }
	add_to_variable = { ENG_NDL_Mec_Moderate_Strength = -0.01 }
	add_to_variable = { ENG_NDL_Mec_Conserv_Strength = -0.01 }
	ENG_NDL_MEC_Clamp_Power = yes
	if = {
		limit = {
			check_variable = {
				var = ENG_NDL_Mec_Liberal_Strength
				value = 0.41
				compare = greater_than_or_equals
			}
		}
		ENG = {
			country_event = {
				id = FEN_NDL_Mechanic.1
				days = 1
			}
		}
	}
	#hidden_effect = {
	#	activate_mission = ENG_DEC_test_liberal_growth
	#}
	if = {
		limit = {
			NOT = {
				has_country_flag = ENG_NDL_Liberal_Growth
			}
		}
		set_country_flag = ENG_NDL_Liberal_Growth
		custom_effect_tooltip = ENG_TT_NDL_MEC_Liberal_Tick_Begin
	}
	else_if = {
		limit = {
			has_country_flag = ENG_NDL_Liberal_Growth
		}
		custom_effect_tooltip = ENG_TT_NDL_MEC_Liberal_Tick_Continue
	}
}

ENG_NDL_MEC_Begin_Moderate_Tick = {
	add_to_variable = { ENG_NDL_Mec_Moderate_Strength = 0.02 }
	add_to_variable = { ENG_NDL_Mec_Liberal_Strength = -0.01 }
	add_to_variable = { ENG_NDL_Mec_Conserv_Strength = -0.01 }
	ENG_NDL_MEC_Clamp_Power = yes
	if = {
		limit = {
			check_variable = {
				var = ENG_NDL_Mec_Moderate_Strength
				value = 0.41
				compare = greater_than_or_equals
			}
		}
		ENG = {
			country_event = {
				id = FEN_NDL_Mechanic.2
				days = 1
			}
		}
	}
	#hidden_effect = {
	#	activate_mission = ENG_DEC_test_moderate_growth
	#}
	if = {
		limit = {
			NOT = {
				has_country_flag = ENG_NDL_Moderate_Growth
			}
		}
		set_country_flag = ENG_NDL_Moderate_Growth
		custom_effect_tooltip = ENG_TT_NDL_MEC_Moderate_Tick_Begin
	}
	else_if = {
		limit = {
			has_country_flag = ENG_NDL_Moderate_Growth
		}
		custom_effect_tooltip = ENG_TT_NDL_MEC_Moderate_Tick_Continue
	}
}

ENG_NDL_MEC_Begin_Conservative_Tick = {
	add_to_variable = { ENG_NDL_Mec_Conserv_Strength = 0.02 }
	add_to_variable = { ENG_NDL_Mec_Liberal_Strength = -0.01 }
	add_to_variable = { ENG_NDL_Mec_Moderate_Strength = -0.01 }
	ENG_NDL_MEC_Clamp_Power = yes
	if = {
		limit = {
			check_variable = {
				var = ENG_NDL_Mec_Conserv_Strength
				value = 0.41
				compare = greater_than_or_equals
			}
		}
		ENG = {
			country_event = {
				id = FEN_NDL_Mechanic.3
				days = 1
			}
		}
	}
	#hidden_effect = {
	#	activate_mission = ENG_DEC_test_conservative_growth
	#}
	if = {
		limit = {
			NOT = {
				has_country_flag = ENG_NDL_Conservative_Growth
			}
		}
		set_country_flag = ENG_NDL_Conservative_Growth
		custom_effect_tooltip = ENG_TT_NDL_MEC_Conservative_Tick_Begin
	}
	else_if = {
		limit = {
			has_country_flag = ENG_NDL_Conservative_Growth
		}
		custom_effect_tooltip = ENG_TT_NDL_MEC_Conservative_Tick_Continue
	}
}

ENG_NDL_MEC_End_Liberal_Tick = {
	clr_country_flag = ENG_NDL_Liberal_Growth
	custom_effect_tooltip = ENG_TT_NDL_MEC_Liberal_Tick_End
}
ENG_NDL_MEC_End_Moderate_Tick = {
	clr_country_flag = ENG_NDL_Moderate_Growth
	custom_effect_tooltip = ENG_TT_NDL_MEC_Moderate_Tick_End
}
ENG_NDL_MEC_End_Conservative_Tick = {
	clr_country_flag = ENG_NDL_Conservative_Growth
	custom_effect_tooltip = ENG_TT_NDL_MEC_Conservative_Tick_End
}

ENG_NDL_MEC_Liberals_gain_power = {
	add_to_variable = { ENG_NDL_Mec_Liberal_Strength = 0.02 }
	add_to_variable = { ENG_NDL_Mec_Moderate_Strength = -0.01 }
	add_to_variable = { ENG_NDL_Mec_Conserv_Strength = -0.01 }
	ENG_NDL_MEC_Clamp_Power = yes
	custom_effect_tooltip = FEN_NDL_liberals_gain_strength
}

ENG_NDL_MEC_Moderates_gain_power = {
	add_to_variable = { ENG_NDL_Mec_Moderate_Strength = 0.02 }
	add_to_variable = { ENG_NDL_Mec_Liberal_Strength = -0.01 }
	add_to_variable = { ENG_NDL_Mec_Conserv_Strength = -0.01 }
	ENG_NDL_MEC_Clamp_Power = yes
	custom_effect_tooltip = FEN_NDL_moderates_gain_strength
}

ENG_NDL_MEC_Conservatives_gain_power = {
	add_to_variable = { ENG_NDL_Mec_Conserv_Strength = 0.02 }
	add_to_variable = { ENG_NDL_Mec_Liberal_Strength = -0.01 }
	add_to_variable = { ENG_NDL_Mec_Moderate_Strength = -0.01 }
	ENG_NDL_MEC_Clamp_Power = yes
	custom_effect_tooltip = FEN_NDL_conservatives_gain_strength
}

ENG_NDL_MEC_Liberals_lose_power = {
	add_to_variable = { ENG_NDL_Mec_Liberal_Strength = -0.02 }
	add_to_variable = { ENG_NDL_Mec_Moderate_Strength = 0.01 }
	add_to_variable = { ENG_NDL_Mec_Conserv_Strength = 0.01 }
	ENG_NDL_MEC_Clamp_Power = yes
	custom_effect_tooltip = FEN_NDL_liberals_lose_strength
}

ENG_NDL_MEC_Moderates_lose_power = {
	add_to_variable = { ENG_NDL_Mec_Moderate_Strength = -0.02 }
	add_to_variable = { ENG_NDL_Mec_Liberal_Strength = 0.01 }
	add_to_variable = { ENG_NDL_Mec_Conserv_Strength = 0.01 }
	ENG_NDL_MEC_Clamp_Power = yes
	custom_effect_tooltip = FEN_NDL_moderates_lose_strength
}

ENG_NDL_MEC_Conservatives_lose_power = {
	add_to_variable = { ENG_NDL_Mec_Conserv_Strength = -0.02 }
	add_to_variable = { ENG_NDL_Mec_Liberal_Strength = 0.01 }
	add_to_variable = { ENG_NDL_Mec_Moderate_Strength = 0.01 }
	ENG_NDL_MEC_Clamp_Power = yes
	custom_effect_tooltip = FEN_NDL_conservatives_lose_strength
}

ENG_NDL_MEC_Moderates_gain_big_power = {
	add_to_variable = { ENG_NDL_Mec_Moderate_Strength = 0.04 }
	add_to_variable = { ENG_NDL_Mec_Liberal_Strength = -0.02 }
	add_to_variable = { ENG_NDL_Mec_Conserv_Strength = -0.02 }
	ENG_NDL_MEC_Clamp_Power = yes
	custom_effect_tooltip = FEN_NDL_moderates_gain_strength
}

ENG_NDL_MEC_Liberals_beat_Conservatives = {
	add_to_variable = { ENG_NDL_Mec_Liberal_Strength = 0.03 }
	add_to_variable = { ENG_NDL_Mec_Conserv_Strength = -0.03 }
	ENG_NDL_MEC_Clamp_Power = yes
	custom_effect_tooltip = FEN_NDL_liberals_gain_strength
}

ENG_NDL_MEC_Conservatives_beat_Liberals = {
	add_to_variable = { ENG_NDL_Mec_Liberal_Strength = -0.03 }
	add_to_variable = { ENG_NDL_Mec_Conserv_Strength = 0.03 }
	ENG_NDL_MEC_Clamp_Power = yes
	custom_effect_tooltip = FEN_NDL_conservatives_gain_strength
}

ENG_NDL_MEC_Clamp_Power = {
	clamp_variable = {
		var = ENG_NDL_Mec_Moderate_Strength
		min = 0
		max = 1
	}
	clamp_variable = {
		var = ENG_NDL_Mec_Liberal_Strength
		min = 0
		max = 1
	}
	clamp_variable = {
		var = ENG_NDL_Mec_Conserv_Strength
		min = 0
		max = 1
	}
	set_temp_variable = { ENG_NDL_total_power = ENG_NDL_Mec_Moderate_Strength }
	add_to_temp_variable = { ENG_NDL_total_power = ENG_NDL_Mec_Liberal_Strength }
	add_to_temp_variable = { ENG_NDL_total_power = ENG_NDL_Mec_Conserv_Strength }

	divide_variable = { ENG_NDL_Mec_Moderate_Strength = ENG_NDL_total_power }
	divide_variable = { ENG_NDL_Mec_Liberal_Strength = ENG_NDL_total_power }
	divide_variable = { ENG_NDL_Mec_Conserv_Strength = ENG_NDL_total_power }
}

####### SLP Stuff ######

ENG_SLP_Add_Reformer_Love_1 = {
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = 0.01
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = -0.01
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = HMMLR_COUP
	#			option = HMMLR_COUP_BIRCH
	#		}
	#		NOT = {
	#			check_variable = { ENG_Hardliner_SLP_Lovers > ENG_Reformers_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Hardliner_SLP_Lovers = ENG_Reformers_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Hardliner_SLP_Lovers
	#		value = 0.01
	#	}
	#}
	SLP_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Reformist_Gain_1_tt
}

ENG_SLP_Add_Reformer_Love_3 = {
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = 0.03
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = -0.03
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = HMMLR_COUP
	#			option = HMMLR_COUP_BIRCH
	#		}
	#		NOT = {
	#			check_variable = { ENG_Hardliner_SLP_Lovers > ENG_Reformers_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Hardliner_SLP_Lovers = ENG_Reformers_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Hardliner_SLP_Lovers
	#		value = 0.01
	#	}
	#}
	SLP_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Reformist_Gain_3_tt
}

ENG_SLP_Add_Reformer_Love_5 = {
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = 0.05
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = -0.05
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = HMMLR_COUP
	#			option = HMMLR_COUP_BIRCH
	#		}
	#		NOT = {
	#			check_variable = { ENG_Hardliner_SLP_Lovers > ENG_Reformers_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Hardliner_SLP_Lovers = ENG_Reformers_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Hardliner_SLP_Lovers
	#		value = 0.01
	#	}
	#}
	SLP_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Reformist_Gain_5_tt
}

ENG_SLP_Add_Reformer_Love_10 = {
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = 0.10
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = -0.10
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = HMMLR_COUP
	#			option = HMMLR_COUP_BIRCH
	#		}
	#		NOT = {
	#			check_variable = { ENG_Hardliner_SLP_Lovers > ENG_Reformers_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Hardliner_SLP_Lovers = ENG_Reformers_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Hardliner_SLP_Lovers
	#		value = 0.01
	#	}
	#}
	SLP_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Reformist_Gain_10_tt
}

ENG_SLP_Add_Hardliner_Love_1 = {
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = 0.01
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = -0.01
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = HMMLR_COUP
	#			option = HMMLR_COUP_NO
	#		}
	#		NOT = {
	#			check_variable = { ENG_Reformers_SLP_Lovers > ENG_Hardliner_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Reformers_SLP_Lovers = ENG_Hardliner_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Reformers_SLP_Lovers
	#		value = 0.01
	#	}
	#}
	SLP_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Hardliner_Gain_1_tt
}

ENG_SLP_Add_Hardliner_Love_3 = {
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = 0.03
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = -0.03
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = HMMLR_COUP
	#			option = HMMLR_COUP_NO
	#		}
	#		NOT = {
	#			check_variable = { ENG_Reformers_SLP_Lovers > ENG_Hardliner_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Reformers_SLP_Lovers = ENG_Hardliner_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Reformers_SLP_Lovers
	#		value = 0.01
	#	}
	#}
	SLP_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Hardliner_Gain_3_tt
}

ENG_SLP_Add_Hardliner_Love_5 = {
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = 0.05
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = -0.05
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = HMMLR_COUP
	#			option = HMMLR_COUP_NO
	#		}
	#		NOT = {
	#			check_variable = { ENG_Reformers_SLP_Lovers > ENG_Hardliner_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Reformers_SLP_Lovers = ENG_Hardliner_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Reformers_SLP_Lovers
	#		value = 0.01
	#	}
	#}
	SLP_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Hardliner_Gain_5_tt
}

ENG_SLP_Add_Hardliner_Love_10 = {
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = 0.10
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = -0.10
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = HMMLR_COUP
	#			option = HMMLR_COUP_NO
	#		}
	#		NOT = {
	#			check_variable = { ENG_Reformers_SLP_Lovers > ENG_Hardliner_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Reformers_SLP_Lovers = ENG_Hardliner_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Reformers_SLP_Lovers
	#		value = 0.01
	#	}
	#}
	SLP_GUI_REFRESH = yes
	custom_effect_tooltip = ENG_DEC_Hardliner_Gain_10_tt
}

ENG_SLP_Tick = {
	if = {
		limit = {
			ENG = {
				has_country_flag = SLP_HUMOR
			}
		}
		ENG = {
			if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.05
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = 0.10
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_gain_10_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.05
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.10
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = 0.09
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_gain_9_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.10
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.15
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = 0.08
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_gain_8_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.15
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.20
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = 0.07
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_gain_7_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.20
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.25
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = 0.06
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_gain_6_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.25
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.30
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = 0.05
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_gain_5_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.30
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.35
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = 0.04
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_gain_4_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.35
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.40
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = 0.03
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_gain_3_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.40
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.45
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = 0.02
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_gain_2_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.45
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.50
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = 0.01
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_gain_1_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.50
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.55
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = -0.01
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_lose_1_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.55
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.60
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = -0.02
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_lose_2_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.60
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.65
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = -0.03
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_lose_3_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.65
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.70
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = -0.04
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_lose_4_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.70
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.75
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = -0.05
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_lose_5_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.75
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.80
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = -0.06
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_lose_6_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.80
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.85
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = -0.07
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_lose_7_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.85
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.90
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = -0.08
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_lose_8_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.90
						compare = greater_than_or_equals
					}
					NOT = {
						check_variable = {
							var = ENG_Hardliner_SLP_Lovers
							value = 0.95
							compare = greater_than_or_equals
						}
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = -0.09
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_lose_9_tt
			}
			else_if = {
				limit = {
					check_variable = {
						var = ENG_Hardliner_SLP_Lovers
						value = 0.95
						compare = greater_than_or_equals
					}
				}
				add_to_variable = {
					var = ENG_SLPReformation_process
					value = -0.10
				}
				clamp_variable = {
					var = ENG_SLPReformation_process
					min = 0
					max = 1
				}
				custom_effect_tooltip = ENG_SLP_lose_10_tt
			}
		}
	}
	SLP_GUI_REFRESH = yes
}

ENG_SLP_Remove_Reformer_Love_1 = {
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = -0.01
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = 0.01
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		OR = {
	#			has_game_rule = {
	#				rule = HMMLR_COUP
	#				option = HMMLR_COUP_NO
	#			}
	#			has_game_rule = {
	#				rule = HMMLR_COUP
	#				option = HMMLR_COUP_BIRCH
	#			}
	#		}
	#		NOT = {
	#			check_variable = { ENG_Reformers_SLP_Lovers > ENG_Hardliner_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Hardliner_SLP_Lovers = ENG_Reformers_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Hardliner_SLP_Lovers
	#		value = -0.01
	#	}
	#}
	custom_effect_tooltip = ENG_DEC_Reformist_Lose_1_tt
}

ENG_SLP_Remove_Reformer_Love_3 = {
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = -0.03
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = 0.03
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		OR = {
	#			has_game_rule = {
	#				rule = HMMLR_COUP
	#				option = HMMLR_COUP_NO
	#			}
	#			has_game_rule = {
	#				rule = HMMLR_COUP
	#				option = HMMLR_COUP_BIRCH
	#			}
	#		}
	#		NOT = {
	#			check_variable = { ENG_Reformers_SLP_Lovers > ENG_Hardliner_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Hardliner_SLP_Lovers = ENG_Reformers_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Hardliner_SLP_Lovers
	#		value = -0.01
	#	}
	#}
	custom_effect_tooltip = ENG_DEC_Reformist_Lose_3_tt
}

ENG_SLP_Remove_Reformer_Love_5 = {
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = -0.05
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = 0.05
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		OR = {
	#			has_game_rule = {
	#				rule = HMMLR_COUP
	#				option = HMMLR_COUP_NO
	#			}
	#			has_game_rule = {
	#				rule = HMMLR_COUP
	#				option = HMMLR_COUP_BIRCH
	#			}
	#		}
	#		NOT = {
	#			check_variable = { ENG_Reformers_SLP_Lovers > ENG_Hardliner_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Hardliner_SLP_Lovers = ENG_Reformers_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Hardliner_SLP_Lovers
	#		value = -0.01
	#	}
	#}
	custom_effect_tooltip = ENG_DEC_Reformist_Lose_5_tt
}

ENG_SLP_Remove_Reformer_Love_10 = {
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = -0.10
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = 0.10
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		OR = {
	#			has_game_rule = {
	#				rule = HMMLR_COUP
	#				option = HMMLR_COUP_NO
	#			}
	#			has_game_rule = {
	#				rule = HMMLR_COUP
	#				option = HMMLR_COUP_BIRCH
	#			}
	#		}
	#		NOT = {
	#			check_variable = { ENG_Reformers_SLP_Lovers > ENG_Hardliner_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Hardliner_SLP_Lovers = ENG_Reformers_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Hardliner_SLP_Lovers
	#		value = -0.01
	#	}
	#}
	custom_effect_tooltip = ENG_DEC_Reformist_Lose_10_tt
}

ENG_SLP_Remove_Hardliner_Love_1 = {
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = -0.01
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = 0.01
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = HMMLR_COUP
	#			option = HMMLR_COUP_BIRCH
	#		}
	#		NOT = {
	#			check_variable = { ENG_Hardliner_SLP_Lovers > ENG_Reformers_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Reformers_SLP_Lovers = ENG_Hardliner_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Reformers_SLP_Lovers
	#		value = -0.01
	#	}
	#}
	custom_effect_tooltip = ENG_DEC_Hardliner_Lose_1_tt
}

ENG_SLP_Remove_Hardliner_Love_3 = {
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = -0.03
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = 0.03
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = HMMLR_COUP
	#			option = HMMLR_COUP_BIRCH
	#		}
	#		NOT = {
	#			check_variable = { ENG_Hardliner_SLP_Lovers > ENG_Reformers_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Reformers_SLP_Lovers = ENG_Hardliner_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Reformers_SLP_Lovers
	#		value = -0.01
	#	}
	#}
	custom_effect_tooltip = ENG_DEC_Hardliner_Lose_3_tt
}

ENG_SLP_Remove_Hardliner_Love_5 = {
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = -0.05
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = 0.05
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = HMMLR_COUP
	#			option = HMMLR_COUP_BIRCH
	#		}
	#		NOT = {
	#			check_variable = { ENG_Hardliner_SLP_Lovers > ENG_Reformers_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Reformers_SLP_Lovers = ENG_Hardliner_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Reformers_SLP_Lovers
	#		value = -0.01
	#	}
	#}
	custom_effect_tooltip = ENG_DEC_Hardliner_Lose_5_tt
}

ENG_SLP_Remove_Hardliner_Love_10 = {
	add_to_variable = {
		var = ENG_Hardliner_SLP_Lovers
		value = -0.10
	}
	clamp_variable = {
		var = ENG_Hardliner_SLP_Lovers
		min = 0
		max = 1
	}
	add_to_variable = {
		var = ENG_Reformers_SLP_Lovers
		value = 0.10
	}
	clamp_variable = {
		var = ENG_Reformers_SLP_Lovers
		min = 0
		max = 1
	}
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = HMMLR_COUP
	#			option = HMMLR_COUP_BIRCH
	#		}
	#		NOT = {
	#			check_variable = { ENG_Hardliner_SLP_Lovers > ENG_Reformers_SLP_Lovers }
	#		}
	#	}
	#	set_variable = {
	#		ENG_Reformers_SLP_Lovers = ENG_Hardliner_SLP_Lovers
	#	}
	#	add_to_variable = {
	#		var = ENG_Reformers_SLP_Lovers
	#		value = -0.01
	#	}
	#}
	custom_effect_tooltip = ENG_DEC_Hardliner_Lose_10_tt
}


ENG_SLP_Add_Reform_Progress_1 = {
	add_to_variable = {
		var = ENG_SLPReformation_process
		value = 0.01
	}
	clamp_variable = {
		var = ENG_SLPReformation_process
		min = 0
		max = 1
	}
	custom_effect_tooltip = ENG_DEC_Reform_Progress_1_tt
}

ENG_SLP_Add_Reform_Progress_3 = {
	add_to_variable = {
		var = ENG_SLPReformation_process
		value = 0.03
	}
	clamp_variable = {
		var = ENG_SLPReformation_process
		min = 0
		max = 1
	}
	custom_effect_tooltip = ENG_DEC_Reform_Progress_3_tt
}

ENG_SLP_Add_Reform_Progress_5 = {
	add_to_variable = {
		var = ENG_SLPReformation_process
		value = 0.05
	}
	clamp_variable = {
		var = ENG_SLPReformation_process
		min = 0
		max = 1
	}
	custom_effect_tooltip = ENG_DEC_Reform_Progress_5_tt
}

ENG_SLP_Add_Reform_Progress_10 = {
	add_to_variable = {
		var = ENG_SLPReformation_process
		value = 0.10
	}
	clamp_variable = {
		var = ENG_SLPReformation_process
		min = 0
		max = 1
	}
	custom_effect_tooltip = ENG_DEC_Reform_Progress_10_tt
}

########
#MILMAN#
########

ENG_MILMAN_INIT = {
	set_country_flag = ENG_MILMAN_INIT
	if = { limit = { is_ai = yes }
		set_variable = { ENG_MIL_LOY = 65	}
		set_variable = { ENG_MIL_EFF = 45	}
		set_variable = { ENG_MIL_LOY_FLR = 60	}
		set_variable = { ENG_MIL_EFF_FLR = 45	}
	}
	else = {
		set_variable = { ENG_MIL_LOY = 45	}
		set_variable = { ENG_MIL_EFF = 25	}
		set_variable = { ENG_MIL_LOY_FLR = 40	}
		set_variable = { ENG_MIL_EFF_FLR = 25	}
	}
	set_variable = {
		var = mission_govtstab
		value = 75
	}
	set_variable = {
		var = mission_army_prof
		value = 75
	}
	ENG_MILMAN_CALC = yes
	add_dynamic_modifier = { modifier = ENG_MILMAN_FX }
	ENG_MILMAN_GOVTSTAB_INITIALIZER = yes
	set_variable = { ENG_MIL_EFF_NXT_MTH = 25 }
}

ENG_MILMAN_CALC = {
##fully working now
	clamp_variable = {
		var = ENG_MIL_LOY
		min = 0
		max = 100
	}
	clamp_variable = {
		var = ENG_MIL_LOY_FLR
		min = 0
		max = 100
	}
	clamp_variable = {
		var = ENG_MIL_EFF
		min = 0
		max = 100
	}
	clamp_variable = {
		var = ENG_MIL_EFF_FLR
		min = 0
		max = 100
	}
	set_variable = { ENG_MIL_LOY_CALC1 = ENG_MIL_LOY }
	set_variable = { ENG_MIL_EFF_CALC1 = ENG_MIL_EFF }

	subtract_from_variable = { ENG_MIL_LOY_CALC1 = 75 } ##var ranges from -75 to 25
	subtract_from_variable = { ENG_MIL_EFF_CALC1 = 75 }

	multiply_variable = { ENG_MIL_LOY_CALC1 = 0.002 }  ##loyalty stab effects range from -0.15 to 0.05
	multiply_variable = { ENG_MIL_EFF_CALC1 = 0.004 } ##division stat effects range from -0.3 to 0.1

	##CALCULATING LOYALTY METAMODIFERS ON EFFICIENCY

	set_variable = { ENG_MIL_LOYxEFF = ENG_MIL_LOY } ##this new tempvar is used to calculate the effects of loyalty upon efficiency.

	if = { ##low efficiency scenario, high loyalty buffers the effects of low efficiency
		limit = {
			check_variable = { ENG_MIL_EFF < 75 }
		}
		multiply_variable = { ENG_MIL_LOYxEFF = -0.005 } ## variable now ranges from -0.5 (highest loyalty) to 0 (lowest loyalty).
		add_to_variable = { ENG_MIL_LOYxEFF = 1.25 } ##variable now ranges from 0.75 (highest loyalty) to 1.25 (lowest loyalty). high loyalty mitigates the effects of poor efficiency, low loyalty exacerbates it.
	}
	else_if = {
		limit = {
			check_variable = {
				var = ENG_MIL_EFF
				value = 75
				compare = greater_than_or_equals
			}
		}
		multiply_variable = { ENG_MIL_LOYxEFF = 0.005 } ## makes this tempvar range from 0 to 0.5
		add_to_variable = { ENG_MIL_LOYxEFF = 0.75 } ## makes this tempvar range from 0.75 to 1.25. high loyalty increases efficiency, low loyalty reduces efficiency
	}

	multiply_variable = { ENG_MIL_EFF_CALC1 = ENG_MIL_LOYxEFF } ##Apply loyalty fx on efficiency

	##CALCULATING EFFICIENCY METAMODIFIERS ON LOYALTY

	set_variable = { ENG_MIL_EFFxLOY = ENG_MIL_EFF }

	multiply_variable = { ENG_MIL_EFFxLOY = 0.005 } #tempvar ranges from 0 to 0.5
	add_to_variable = { ENG_MIL_EFFxLOY = 0.75 } #tempvar ranges from 0.75 to 1.25
	multiply_variable = { ENG_MIL_LOY_CALC1 = ENG_MIL_EFFxLOY }

	set_variable = { ENG_MILMAN_FX = ENG_MIL_EFF_CALC1 }
	set_variable = { ENG_MILMAN_ORG = ENG_MIL_LOY_CALC1 }

	set_variable = { ENG_MILMAN_STAB_SHOW = ENG_MIL_LOY }
	subtract_from_variable = { ENG_MILMAN_STAB_SHOW = 75 }
	multiply_variable = { ENG_MILMAN_STAB_SHOW = 0.002 }
	if = {
		limit = { has_country_flag = MILMAN_GOVSTAB_INITIALIZED }
		ENG_MILMAN_GOVTSTAB_CALC = yes
	}
	clear_variable = ENG_MIL_LOY_CALC1
	clear_variable = ENG_MIL_EFF_CALC1
	clear_variable = ENG_MIL_LOYxEFF
	clear_variable = ENG_MIL_EFFxLOY
	ENG_MILMAN_DECAY_CALC = yes
}

ENG_MILMAN_DECAY_CALC = {

	set_variable = { ENG_MIL_LOY_DECAY = ENG_MIL_LOY }
	subtract_from_variable = { ENG_MIL_LOY_DECAY = ENG_MIL_LOY_FLR }
	if = {
		limit = {
			OR = {
				check_variable = {
					var = ENG_MIL_LOY_DECAY
					value = 0.101 ##doesn't work if i set it to 0.1 and i have no idea why
					compare = greater_than_or_equals
				}
				check_variable = {
					var = ENG_MIL_LOY_DECAY
					value = -0.101
					compare = less_than_or_equals
				}
			}
		}
		multiply_variable = { ENG_MIL_LOY_DECAY = 0.319 } ###calculates how much to subtract / add every month to loyalty. variable decays 90% to floor every 6 months with this constant.
		set_variable = { ENG_MIL_LOY_NXT_MTH = ENG_MIL_LOY }
		subtract_from_variable = { ENG_MIL_LOY_NXT_MTH = ENG_MIL_LOY_DECAY } ##precalculate values for the next month after decay. useful to show player.

		##rounding to 1 decimal place
		multiply_variable = { ENG_MIL_LOY_NXT_MTH = 10 }
		round_variable = ENG_MIL_LOY_NXT_MTH
		multiply_variable = { ENG_MIL_LOY_NXT_MTH = 0.1 }
	}
	else_if = {  ##this block is used to ensure that the values don't get stuck extremely close to the floor. also saves a teensy amount of computational power
		limit = {
			OR = {
				AND = {
					check_variable = { ENG_MIL_LOY_DECAY < 0.101 }
					check_variable = { ENG_MIL_LOY_DECAY > 0 }
				}
				AND = {
					check_variable = { ENG_MIL_LOY_DECAY > -0.101 }
					check_variable = { ENG_MIL_LOY_DECAY < 0 }
				}
				check_variable = { ENG_MIL_LOY_DECAY = 0 }
			}
		}
		set_variable = { ENG_MIL_LOY_NXT_MTH = ENG_MIL_LOY_FLR }
	}


	set_variable = { ENG_MIL_EFF_DECAY = ENG_MIL_EFF }
	subtract_from_variable = { ENG_MIL_EFF_DECAY = ENG_MIL_EFF_FLR }

	if = {
		limit = {
			OR = {
				check_variable = {
					var = ENG_MIL_EFF_DECAY
					value = 0.101
					compare = greater_than_or_equals
				}
				check_variable = {
					var = ENG_MIL_EFF_DECAY
					value = -0.101
					compare = less_than_or_equals
				}
			}
		}
		multiply_variable = { ENG_MIL_EFF_DECAY = 0.319 } ###calculates how much to subtract / add every month to efficiency
		set_variable = { ENG_MIL_EFF_NXT_MTH = ENG_MIL_EFF }
		subtract_from_variable = { ENG_MIL_EFF_NXT_MTH = ENG_MIL_EFF_DECAY }

		multiply_variable = { ENG_MIL_EFF_NXT_MTH = 10 }
		round_variable = ENG_MIL_EFF_NXT_MTH
		multiply_variable = { ENG_MIL_EFF_NXT_MTH = 0.1 }
	}
	else_if = {
		limit = {
			OR = {
				AND = {
					check_variable = { ENG_MIL_EFF_DECAY < 0.101 }
					check_variable = { ENG_MIL_EFF_DECAY > 0 }
				}
				AND = {
					check_variable = { ENG_MIL_EFF_DECAY > -0.101 }
					check_variable = { ENG_MIL_EFF_DECAY < 0 }
				}
			}
		}
		set_variable = { ENG_MIL_EFF_NXT_MTH = ENG_MIL_EFF_FLR }
	}
}

ENG_MILMAN_DECAY_EXEC = {
	#EXEC AND CALC EFFECTS ARE SEPARATED SO THAT TOOLTIPS CAN SHOW THE PLAYER THE EXPECTED VALUES FOR THE NEXT MONTH. THIS EFFECT SHOULD BE FIRED MONTHLY.
	if = {
		limit = {
			ENG = {
				has_country_flag = ENG_MILMAN_INIT
			}
		}
		ENG = {
			set_variable = { ENG_MIL_LOY = ENG_MIL_LOY_NXT_MTH }
			set_variable = { ENG_MIL_EFF = ENG_MIL_EFF_NXT_MTH }
			ENG_MILMAN_CALC = yes
		}
	}
}

ENG_MILMAN_GOVTSTAB_INITIALIZER = {
	set_variable = { ENG_MILMAN_STAB_STORAGE = ENG_MIL_LOY }

	add_to_variable = { ParliamentMechanic_GovStab = ENG_MILMAN_STAB_SHOW }
	clamp_variable = {
		var = ParliamentMechanic_GovStab
		min = 0
		max = 1
	}
	set_country_flag = MILMAN_GOVSTAB_INITIALIZED
}

ENG_MILMAN_GOVTSTAB_CALC = {

	set_variable = { ENG_MILMAN_STAB = ENG_MIL_LOY } #ENG_MIL_LOY

	subtract_from_variable = {
		var = ENG_MILMAN_STAB #60 = 0.12
		value = ENG_MILMAN_STAB_STORAGE #45 = 0.09

	}

	multiply_variable = { ENG_MILMAN_STAB = 0.002 }
	add_to_variable = { ParliamentMechanic_GovStab = ENG_MILMAN_STAB }


	clear_variable = ENG_MILMAN_STAB_STORAGE

	set_variable = { ENG_MILMAN_STAB_STORAGE = ENG_MIL_LOY } #ENG_MIL_LOY

	clamp_variable = {
		var = ParliamentMechanic_GovStab
		min = 0
		max = 1
	}
}

####GOVERNMENT STABILITY SHIZZLE####

ENG_GOVSTAB_MINUS5 = {
	add_to_variable = { ParliamentMechanic_GovStab = -0.05 }
	clamp_variable = {
		var = ParliamentMechanic_GovStab
		min = 0
		max = 1
	}
	custom_effect_tooltip = ENG_Government_Stab_reduction5.tt
}
###########################################################################################################################################################################################################################################################################
#QUICK NOTE: RECONSTRUCTION FOR BOTH THE COLLABS AND FREE ENGLAND USES THE SAME VARIABLES! MAKE SURE TO SET EITHER 'ENG_reconstruction_initialized_collab' or 'ENG_reconstruction_initialized_free' IF YOU WANT IT TO WORK CORRECTLY, PM FLIZZY#6123 IF YOU HAVE QUESTIONS#
###########################################################################################################################################################################################################################################################################

ENG_RECONSTRUCTION_initialize = {
	log = "[GetDateText]: [Root.GetName]: ENG_RECONSTRUCTION_initialize"
	every_owned_state = {
		set_variable = { parl_seats = state_population_k }
		divide_variable = { parl_seats = 150 }
		round_variable = parl_seats
		set_variable = { reconstruction_liberal_drift = 0 }
		set_variable = { reconstruction_conservative_drift = 0 }
	}
	hidden_effect = {
		country_event = {
			id = ENG_reconstruction.1
			days = 7
		}
	}
	885 = {
		set_state_flag = reconstruction_SLP_state
		set_variable = { reconstruction_SLP_support = 50 }
		set_variable = { reconstruction_NDL_support = 50 }
	}
	132 = {
		set_state_flag = reconstruction_SLP_state
		set_variable = { reconstruction_SLP_support = 50 }
		set_variable = { reconstruction_NDL_support = 50 }
	}
	128 = {
		set_state_flag = reconstruction_SLP_state
		set_variable = { reconstruction_SLP_support = 50 }
		set_variable = { reconstruction_NDL_support = 50 }
	}
	129 = {
		set_state_flag = reconstruction_SLP_state
		set_variable = { reconstruction_SLP_support = 50 }
		set_variable = { reconstruction_NDL_support = 50 }
	}
	131 = {
		set_state_flag = reconstruction_NDL_state
		set_variable = { reconstruction_SLP_support = 50 }
		set_variable = { reconstruction_NDL_support = 50 }
	}
	130 = {
		set_state_flag = reconstruction_NDL_state
		set_variable = { reconstruction_SLP_support = 50 }
		set_variable = { reconstruction_NDL_support = 50 }
	}
	125 = {
		set_state_flag = reconstruction_NDL_state
		set_variable = { reconstruction_SLP_support = 50 }
		set_variable = { reconstruction_NDL_support = 50 }
	}
	126 = {
		set_state_flag = reconstruction_NDL_state
		set_variable = { reconstruction_SLP_support = 50 }
		set_variable = { reconstruction_NDL_support = 50 }
	}
	128 = {
		set_state_flag = reconstruction_NDL_state
		set_variable = { reconstruction_SLP_support = 50 }
		set_variable = { reconstruction_NDL_support = 50 }
	}
	127 = {
		set_state_flag = reconstruction_neutral_state
		set_variable = { reconstruction_SLP_support = 50 }
		set_variable = { reconstruction_NDL_support = 50 }
	}
	1300 = {
		set_state_flag = reconstruction_neutral_state
		set_variable = { reconstruction_SLP_support = 50 }
		set_variable = { reconstruction_NDL_support = 50 }
	}
	777 = {
		set_state_flag = reconstruction_neutral_state
		set_variable = { reconstruction_SLP_support = 50 }
		set_variable = { reconstruction_NDL_support = 50 }
	}
	338 = {
		set_state_flag = reconstruction_neutral_state
		set_variable = { reconstruction_SLP_support = 50 }
		set_variable = { reconstruction_NDL_support = 50 }
	}
	set_country_flag = ENG_reconstruction_initialized
}

ENG_reconstruction_tick = {
	ENG = {
		every_owned_state = {
			if = {
				limit = { check_variable = { reconstruction_liberal_drift > 0 } }
				add_to_variable = { reconstruction_SLP_support = reconstruction_liberal_drift }
				subtract_from_variable = { reconstruction_NDL_support = reconstruction_liberal_drift }
			}
			if = {
				limit = { check_variable = { reconstruction_conservative_drift > 0 } }
				add_to_variable = { reconstruction_NDL_support = reconstruction_conservative_drift }
				subtract_from_variable = { reconstruction_SLP_support = reconstruction_conservative_drift }
			}
			if = {
				limit = {
					AND = {
						has_state_flag = reconstruction_SLP_commander
						has_state_flag = reconstruction_NDL_state
					}
				}
				random_list = {
					70 = {
						subtract_from_variable = { reconstruction_SLP_support = 5 }
						add_to_variable = { reconstruction_NDL_support = 5 }
					}
					30 = {
						subtract_from_variable = { reconstruction_NDL_support = 5 }
						add_to_variable = { reconstruction_SLP_support = 5 }
					}
				}
			}
			else_if = {
				limit = {
					AND = {
						has_state_flag = reconstruction_SLP_commander
						has_state_flag = reconstruction_SLP_state
					}
				}
				random_list = {
					80 = {
						subtract_from_variable = { reconstruction_NDL_support = 5 }
						add_to_variable = { reconstruction_SLP_support = 5 }
					}
					20 = {
						add_to_variable = { reconstruction_NDL_support = 5 }
						subtract_from_variable = { reconstruction_SLP_support = 5 }
					}
				}
			}
			else_if = {
				limit = {
					AND = {
						has_state_flag = reconstruction_NDL_commander
						has_state_flag = reconstruction_SLP_state
					}
				}
				random_list = {
					70 = {
						subtract_from_variable = { reconstruction_NDL_support = 5 }
						add_to_variable = { reconstruction_SLP_support = 5 }
					}
					30 = {
						subtract_from_variable = { reconstruction_SLP_support = 5 }
						add_to_variable = { reconstruction_NDL_support = 5 }
					}
				}
			}
			else_if = {
				limit = {
					AND = {
						has_state_flag = reconstruction_NDL_commander
						has_state_flag = reconstruction_NDL_state
					}
				}
				random_list = {
					80 = {
						subtract_from_variable = { reconstruction_SLP_support = 5 }
						add_to_variable = { reconstruction_NDL_support = 5 }
					}
					20 = {
						subtract_from_variable = { reconstruction_NDL_support = 5 }
						add_to_variable = { reconstruction_SLP_support = 5 }
					}
				}
			}
			else_if = {
				limit = {
					AND = {
						has_state_flag = reconstruction_NDL_commander
						has_state_flag = reconstruction_neutral_state
					}
				}
				random_list = {
					50 = {
						subtract_from_variable = { reconstruction_SLP_support = 5 }
						add_to_variable = { reconstruction_NDL_support = 5 }
					}
					50 = {
						subtract_from_variable = { reconstruction_NDL_support = 5 }
						add_to_variable = { reconstruction_SLP_support = 5 }
					}
				}
			}
			else_if = {
				limit = {
					AND = {
						has_state_flag = reconstruction_SLP_commander
						has_state_flag = reconstruction_neutral_state
					}
				}
				random_list = {
					50 = {
						subtract_from_variable = { reconstruction_SLP_support = 5 }
						add_to_variable = { reconstruction_NDL_support = 5 }
					}
					50 = {
						subtract_from_variable = { reconstruction_NDL_support = 5 }
						add_to_variable = { reconstruction_SLP_support = 5 }
					}
				}
			}
		}
	}
}

ENG_reconstruction_election = {
	set_temp_variable = { slp_seats_nation = 0 }
	set_temp_variable = { ndl_seats_nation = 0 }
	every_owned_state = {
		set_temp_variable = { slp_support = reconstruction_SLP_support }
		divide_temp_variable = { slp_support = 100 }
		set_temp_variable = { ndl_support = reconstruction_NDL_support }
		divide_temp_variable = { ndl_support = 100 }
		set_temp_variable = { slp_seats_local = parl_seats }
		multiply_temp_variable = { slp_seats_local = slp_support }
		set_temp_variable = { ndl_seats_local = parl_seats }
		multiply_temp_variable = { ndl_seats_local = ndl_support }
		set_temp_variable = { total_seats = ndl_seats_local }
		add_to_temp_variable = { total_seats = slp_seats_local }
		if = {
			limit = { NOT = { check_variable = { total_seats = parl_seats } } }
			set_temp_variable = { seat_disparity = parl_seats }
			subtract_from_temp_variable = { seat_disparity = total_seats }
			if = {
				limit = { check_variable = { slp_seats_local > ndl_seats_local } }
				add_to_temp_variable = { slp_seats_local = seat_disparity }
			}
			else_if = {
				limit = { check_variable = { ndl_seats_local > slp_seats_local } }
				add_to_temp_variable = { ndl_seats_local = seat_disparity }
			}
		}
		add_to_temp_variable = { ndl_seats_nation = ndl_seats_local }
		add_to_temp_variable = { slp_seats_nation = slp_seats_local }
	}
	if = {
		limit = { has_country_flag = ENG_reconstruction_initialized_free }
		if = {
			limit = { check_variable = { ndl_seats_nation > slp_seats_nation } }
			##set_country_flag = flag that says the ndl won
		}
		else_if = {
			limit = { check_variable = { slp_seats_nation > ndl_seats_nation } }
			##set_country_flag = flag that says the slp won
		}
		###UH INTEGRATION INTO PARLIAMENT MECHANIC HERE POTENTIALLY
	}
	if = {
		limit = { has_country_flag = ENG_reconstruction_initialized_collab }
		if = {
			limit = { check_variable = { ndl_seats_nation > slp_seats_nation } }
			##set_country_flag = flag that says the ROYAL PARTY won
		}
		else_if = {
			limit = { check_variable = { slp_seats_nation > ndl_seats_nation } }
			##set_country_flag = flag that says the UNITED ENGLAND PARTY won
		}
		###UH INTEGRATION INTO PARLIAMENT MECHANIC HERE POTENTIALLY
	}
}
FEN_decrease_hunger = {
	if = {
		limit = { has_idea = FEN_Food_Insecurity }
		swap_ideas = {
			remove_idea = FEN_Food_Insecurity
			add_idea = FEN_Food_Insecurity_2
		}
	}
	else_if = {
		limit = { has_idea = FEN_Food_Insecurity_2 }
		swap_ideas = {
			remove_idea = FEN_Food_Insecurity_2
			add_idea = FEN_Food_Insecurity_3
		}
	}
	else_if = {
		limit = { has_idea = FEN_Food_Insecurity_3 }
		swap_ideas = {
			remove_idea = FEN_Food_Insecurity_3
			add_idea = FEN_Food_Insecurity_4
		}
	}
	else_if = {
		limit = { has_idea = FEN_Food_Insecurity_4 }
		swap_ideas = {
			remove_idea = FEN_Food_Insecurity_4
			add_idea = FEN_Food_Insecurity_5
		}
	}
	else_if = {
		limit = { has_idea = FEN_Food_Insecurity_5 }
		remove_ideas = FEN_Food_Insecurity_5
	}
	else = {
		add_stability = 0.05
	}
}

FEN_increase_hunger = {
	if = {
		limit = { has_idea = FEN_Food_Insecurity_5 }
		swap_ideas = {
			remove_idea = FEN_Food_Insecurity_5
			add_idea = FEN_Food_Insecurity_4
		}
	}
	else_if = {
		limit = { has_idea = FEN_Food_Insecurity_4 }
		swap_ideas = {
			remove_idea = FEN_Food_Insecurity_4
			add_idea = FEN_Food_Insecurity_3
		}
	}
	else_if = {
		limit = { has_idea = FEN_Food_Insecurity_3 }
		swap_ideas = {
			remove_idea = FEN_Food_Insecurity_3
			add_idea = FEN_Food_Insecurity_2
		}
	}
	else_if = {
		limit = { has_idea = FEN_Food_Insecurity_2 }
		swap_ideas = {
			remove_idea = FEN_Food_Insecurity_2
			add_idea = FEN_Food_Insecurity
		}
	}
	else_if = {
		limit = { has_idea = FEN_Food_Insecurity }
		add_stability = -0.05
	}
	else = {
		add_ideas = FEN_Food_Insecurity
	}
}

ENG_initialize_Faction_Mechanic = {

	set_global_flag = ENG_Faction_Start_Flag
	TNO_fopo_add_england_influence_battle_tab = yes
	set_variable = { ENG_OFN_Influence = 5 }
	set_variable = { ENG_EP_Influence = 10 }
	set_variable = { ENG_Independent_Influence = 20 }
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = collab_foreign_policy
	#			option = COLLAB_FOREIGN_POLICY_INDEPENDENT
	#		}
	#	}
	#	set_variable = { ENG_Independent_Influence = 100 }
	#	set_variable = { ENG_OFN_Influence = 0 }
	#	set_variable = { ENG_EP_Influence = 0 }
	#}
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = collab_foreign_policy
	#			option = COLLAB_FOREIGN_POLICY_OFN
	#		}
	#	}
	#	set_variable = { ENG_Independent_Influence = 1 }
	#	set_variable = { ENG_OFN_Influence = 100 }
	#	set_variable = { ENG_EP_Influence = 0 }
	#}
	#if = {
	#	limit = {
	#		has_game_rule = {
	#			rule = collab_foreign_policy
	#			option = COLLAB_FOREIGN_POLICY_PAKT
	#		}
	#	}
	#	set_variable = { ENG_Independent_Influence = 0 }
	#	set_variable = { ENG_OFN_Influence = 0 }
	#	set_variable = { ENG_EP_Influence = 100 }
	#}
	set_global_flag = ENG_faction_mechanic_England_Leading
	if = {
		limit = { has_country_flag = ENG_defeated_cornwall }
		custom_effect_tooltip = ENG_defeated_cornwall_faction_mech
		hidden_effect = {
			set_temp_variable = { EP_influence_temp = -10 }
			ENG_EP_Influence_Change = yes
		}
	}
	USA = {
		if = {
			limit = {
				ENG = { has_country_flag = ENG_Thatcher_victorious }
			}
			if = {
				limit = {
					has_country_flag = USA_64_R_RDC
				}
				country_event = {
					id = ENG_International_Mechanic.49
					hours = 6
				}
			}
			else_if = {
				limit = {
					has_country_flag = USA_64_D_RDC
				}
				country_event = {
					id = ENG_International_Mechanic.48
					hours = 6
				}
			}
			else_if = {
				limit = {
					has_country_flag = USA_64_C_NPP
				}
				country_event = {
					id = ENG_International_Mechanic.51
					hours = 6
				}
			}
			else_if = {
				limit = {
					has_country_flag = USA_64_FR_NPP
				}
				country_event = {
					id = ENG_International_Mechanic.50
					hours = 6
				}
			}
			else_if = {
				limit = {
					has_country_flag = USA_68_R_RDC
				}
				country_event = {
					id = ENG_International_Mechanic.55
					hours = 6
				}
			}
			else_if = {
				limit = {
					has_country_flag = USA_68_D_RDC
				}
				country_event = {
					id = ENG_International_Mechanic.54
					hours = 6
				}
			}
			else_if = {
				limit = {
					has_country_flag = USA_68_C_NPP
				}
				country_event = {
					id = ENG_International_Mechanic.52
					hours = 6
				}
			}
			else_if = {
				limit = {
					has_country_flag = USA_68_FR_NPP
				}
				country_event = {
					id = ENG_International_Mechanic.53
					hours = 6
				}
			}
			else_if = {
				limit = {
					has_country_flag = USA_LEMAY
				}
				country_event = {
					id = ENG_International_Mechanic.56
					hours = 6
				}
			}
			else_if = {
				limit = {
					has_country_flag = USA_THURMOND_FR_NPP
				}
				country_event = {
					id = ENG_International_Mechanic.57
					hours = 6
				}
			}
			else = {
				country_event = {
					id = ENG_International_Mechanic.2
					hours = 6
				}
			}
		}
		else = {
			country_event = {
				id = ENG_International_Mechanic.2
				hours = 6
			}
		}
	}
	GER = {
		if = {
			limit = {
				ENG = { has_country_flag = ENG_Thatcher_victorious }
			}
			if = {
				limit = {
					has_global_flag = german_civil_war_speervic
				}
				country_event = {
					id = ENG_International_Mechanic.58
					hours = 6
				}
			}
			else_if = {
				limit = {
					has_country_flag = german_civil_war_bormannvic
				}
				country_event = {
					id = ENG_International_Mechanic.59
					hours = 6
				}
			}
			else = {
				country_event = {
					id = ENG_International_Mechanic.3
					hours = 6
				}
			}
		}
		else = {
			country_event = {
				id = ENG_International_Mechanic.3
				hours = 6
			}
		}
	}
	custom_effect_tooltip = ENG_faction_mechanic_starting_germany_GCW_over
}


ENG_EP_Influence_Change = {
	if = {
		limit = { has_global_flag = ENG_Faction_Start_Flag }
		add_to_variable = { ENG.ENG_EP_Influence = EP_influence_temp }
		if = {
			limit = {
				check_variable = { EP_influence_temp < 0 }
			}
			multiply_temp_variable = {
				var = EP_influence_temp
				value = -1
			}
			custom_effect_tooltip = ENG_EP_influence_decrease_tt
		}
		else = {
			custom_effect_tooltip = ENG_EP_influence_increase_tt
		}
		hidden_effect = {
			ENG = {
				ENG_Faction_Influence_Calc = yes
			}
		}
	}
}

ENG_EP_Influence_Increase_Change = {
	if = {
		limit = { has_global_flag = ENG_Faction_Start_Flag }
		add_to_variable = { ENG.ENG_EP_Influence_Increase = ENG.EP_influence_temp_monthly }
		if = {
			limit = {
				check_variable = { EP_influence_temp_monthly < 0 }
			}
			multiply_temp_variable = {
				var = EP_influence_temp_monthly
				value = -1
			}
			custom_effect_tooltip = ENG_EP_influence_monthly_decrease_tt
		}
		else = {
			custom_effect_tooltip = ENG_EP_influence_monthly_increase_tt
		}
		hidden_effect = {
			ENG = {
				ENG_Faction_Influence_Calc = yes
			}
		}
	}
}

ENG_OFN_Influence_Change = {
	if = {
		limit = { has_global_flag = ENG_Faction_Start_Flag }
		add_to_variable = { ENG.ENG_OFN_Influence = OFN_influence_temp }
		if = {
			limit = {
				check_variable = { OFN_influence_temp < 0 }
			}
			multiply_temp_variable = {
				var = OFN_influence_temp
				value = -1
			}
			custom_effect_tooltip = ENG_OFN_influence_decrease_tt
		}
		else = {
			custom_effect_tooltip = ENG_OFN_influence_increase_tt
		}
		hidden_effect = {
			ENG = {
				ENG_Faction_Influence_Calc = yes
			}
		}
	}
}

ENG_OFN_Influence_Increase_Change = {
	if = {
		limit = { has_global_flag = ENG_Faction_Start_Flag }
		add_to_variable = { ENG.ENG_OFN_Influence_Increase = ENG.OFN_influence_temp_monthly }
		if = {
			limit = {
				check_variable = { OFN_influence_temp_monthly < 0 }
			}
			multiply_temp_variable = {
				var = OFN_influence_temp_monthly
				value = -1
			}
			custom_effect_tooltip = ENG_OFN_influence_monthly_decrease_tt
		}
		else = {
			custom_effect_tooltip = ENG_OFN_influence_monthly_increase_tt
		}
		hidden_effect = {
			ENG = {
				ENG_Faction_Influence_Calc = yes
			}
		}
	}
}

ENG_ENG_Influence_Change = {
	if = {
		limit = { has_global_flag = ENG_Faction_Start_Flag }
		add_to_variable = { ENG.ENG_Independent_Influence = ENG_influence_temp }
		if = {
			limit = {
				check_variable = { ENG_influence_temp < 0 }
			}
			multiply_temp_variable = {
				var = ENG_influence_temp
				value = -1
			}
			custom_effect_tooltip = ENG_ENG_influence_decrease_tt
		}
		else = {
			custom_effect_tooltip = ENG_ENG_influence_increase_tt
		}
		hidden_effect = {
			ENG = {
				ENG_Faction_Influence_Calc = yes
			}
		}
	}
}

ENG_ENG_Influence_Increase_Change = {
	if = {
		limit = { has_global_flag = ENG_Faction_Start_Flag }
		add_to_variable = { ENG.ENG_Independent_Influence_Increase = ENG.ENG_influence_temp_monthly }
		if = {
			limit = {
				check_variable = { ENG_influence_temp_monthly < 0 }
			}
			multiply_temp_variable = {
				var = ENG_influence_temp_monthly
				value = -1
			}
			custom_effect_tooltip = ENG_ENG_influence_monthly_decrease_tt
		}
		else = {
			custom_effect_tooltip = ENG_ENG_influence_monthly_increase_tt
		}
		hidden_effect = {
			ENG = {
				ENG_Faction_Influence_Calc = yes
			}
		}
	}
}

ENG_faction_close_in_6_months = {
	activate_mission = ENG_Faction_Close_Faction_Mechanic_Mission
	GER = {
		activate_mission = GER_Faction_Close_Faction_Mechanic_Mission
		hidden_effect = {
			country_event = {
				id = ENG_International_Mechanic.14
				hours = 3
			}
		}
	}
	USA = {
		activate_mission = USA_Faction_Close_Faction_Mechanic_Mission
		hidden_effect = {
			country_event = {
				id = ENG_International_Mechanic.15
				hours = 3
			}
		}
	}
}

ENG_end_faction_mechanic = {
	hidden_effect = {
		remove_mission = ENG_Faction_Close_Faction_Mechanic_Mission
		hidden_effect = {
			country_event = {
				id = ENG_International_Mechanic.20
				hours = 3
			}
		}
		GER = {
			remove_mission = GER_Faction_Close_Faction_Mechanic_Mission
			hidden_effect = {
				TNO_fopo_remove_england_influence_battle_tab = yes
				country_event = {
					id = ENG_International_Mechanic.16
					hours = 3
				}
			}
		}
		USA = {
			remove_mission = USA_Faction_Close_Faction_Mechanic_Mission
			hidden_effect = {
				TNO_fopo_remove_england_influence_battle_tab = yes
				country_event = {
					id = ENG_International_Mechanic.17
					hours = 3
				}
			}
		}
	}
	set_country_flag = ENG_Ended_faction_Mechanic_Independent
	clr_global_flag = ENG_Faction_Start_Flag
	TNO_fopo_remove_england_influence_battle_tab = yes
}

ENG_Faction_Influence_Calc = { #Calculate who is in the lead and what happens accordingly
	if = {
		limit = {
			NOT = {
				has_global_flag = ENG_joined_faction
			}
		}
		clamp_variable = {
			var = ENG_EP_Influence
			min = 0
		}
		clamp_variable = {
			var = ENG_OFN_Influence
			min = 0
		}
		clamp_variable = {
			var = ENG_Independent_Influence
			min = 0
		}
		#if = {
		#	limit = {
		#		has_game_rule = {
		#			rule = collab_foreign_policy
		#			option = COLLAB_FOREIGN_POLICY_INDEPENDENT
		#		}
		#	}
		#	set_variable = { ENG_Independent_Influence = 100 }
		#	set_variable = { ENG_OFN_Influence = 0 }
		#	set_variable = { ENG_EP_Influence = 0 }
		#}
		#if = {
		#	limit = {
		#		has_game_rule = {
		#			rule = collab_foreign_policy
		#			option = COLLAB_FOREIGN_POLICY_OFN
		#		}
		#	}
		#	set_variable = { ENG_Independent_Influence = 1 }
		#	set_variable = { ENG_OFN_Influence = 100 }
		#	set_variable = { ENG_EP_Influence = 0 }
		#}
		#if = {
		#	limit = {
		#		has_game_rule = {
		#			rule = collab_foreign_policy
		#			option = COLLAB_FOREIGN_POLICY_PAKT
		#		}
		#	}
		#	set_variable = { ENG_Independent_Influence = 0 }
		#	set_variable = { ENG_OFN_Influence = 0 }
		#	set_variable = { ENG_EP_Influence = 100 }
		#}
		if = { #The OFN overpowers both Germany and England
			limit = {
				AND = {
					NOT = {
						has_global_flag = ENG_faction_mechanic_OFN_Leading
					}
					check_variable = { ENG_OFN_Influence > ENG_EP_Influence }
					check_variable = { ENG_OFN_Influence > ENG_Independent_Influence }
				}
			}
			set_global_flag = ENG_faction_mechanic_OFN_Leading
			activate_mission = ENG_Faction_Join_OFN_Mission
			GER = {
				activate_mission = GER_Faction_Join_OFN_Mission
				country_event = { #Warning Event
					id = ENG_International_Mechanic.4
					hours = 20
				}
			}
			USA = {
				activate_mission = USA_Faction_Join_OFN_Mission
			}
			country_event = { #Warning Event
				id = ENG_International_Mechanic.6
				hours = 20
			}
			if = { #If Germany was in the Lead Before
				limit = {
					has_global_flag = ENG_faction_mechanic_Pakt_Leading
				}
				clr_global_flag = ENG_faction_mechanic_Pakt_Leading
				remove_mission = ENG_Faction_Join_Pakt_Mission
				GER = {
					remove_mission = GER_Faction_Join_Pakt_Mission
					country_event = { #Warning Event
						id = ENG_International_Mechanic.10
						hours = 6
					}
				}
				USA = {
					remove_mission = USA_Faction_Join_Pakt_Mission
					country_event = { #Warning Event
						id = ENG_International_Mechanic.8
						hours = 6
					}
				}
			}
			clr_global_flag = ENG_faction_mechanic_England_Leading
		}
		else_if = { #The Pakt overpowers both the OFN and England
			limit = {
				AND = {
					NOT = {
						has_global_flag = ENG_faction_mechanic_Pakt_Leading
					}
					check_variable = { ENG_EP_Influence > ENG_OFN_Influence }
					check_variable = { ENG_EP_Influence > ENG_Independent_Influence }
				}
			}
			set_global_flag = ENG_faction_mechanic_Pakt_Leading
			activate_mission = ENG_Faction_Join_Pakt_Mission
			GER = {
				activate_mission = GER_Faction_Join_Pakt_Mission
			}
			USA = {
				activate_mission = USA_Faction_Join_Pakt_Mission
				country_event = { #Warning Event
					id = ENG_International_Mechanic.5
					hours = 20
				}
			}
			country_event = { #England Warning Event
				id = ENG_International_Mechanic.6
				hours = 20
			}
			if = { #If the OFN was in the lead before
				limit = {
					has_global_flag = ENG_faction_mechanic_OFN_Leading
				}
				clr_global_flag = ENG_faction_mechanic_OFN_Leading
				remove_mission = ENG_Faction_Join_OFN_Mission
				GER = {
					remove_mission = GER_Faction_Join_OFN_Mission
					country_event = { #Warning Event
						id = ENG_International_Mechanic.7
						hours = 6
					}
				}
				USA = {
					remove_mission = USA_Faction_Join_OFN_Mission
					country_event = { #USA Trolled Warning Event
						id = ENG_International_Mechanic.11
						hours = 6
					}
				}
			}
			clr_global_flag = ENG_faction_mechanic_England_Leading
		}
		else_if = { #England Overpowers both Germany and America
			limit = {
				AND = {
					NOT = {
						has_global_flag = ENG_faction_mechanic_England_Leading
					}
					check_variable = { ENG_Independent_Influence > ENG_EP_Influence }
					check_variable = { ENG_Independent_Influence > ENG_OFN_Influence }
				}
			}
			set_global_flag = ENG_faction_mechanic_England_Leading
			if = { #If America was in the Lead Before
				limit = {
					has_global_flag = ENG_faction_mechanic_OFN_Leading
				}
				clr_global_flag = ENG_faction_mechanic_OFN_Leading
				GER = {
					remove_mission = GER_Faction_Join_OFN_Mission
					country_event = { #Warning Event
						id = ENG_International_Mechanic.61
						hours = 20
					}
				}
				USA = {
					remove_mission = USA_Faction_Join_OFN_Mission
					country_event = { #USA Trolled Warning Event
						id = ENG_International_Mechanic.60
						hours = 20
					}
				}
				ENG = {
					remove_mission = ENG_Faction_Join_OFN_Mission
					country_event = { #Warning Event
						id = ENG_International_Mechanic.9
						hours = 20
					}
				}
			}
			else_if = { #If Germany was in the Lead Before
				limit = {
					has_global_flag = ENG_faction_mechanic_Pakt_Leading
				}
				clr_global_flag = ENG_faction_mechanic_Pakt_Leading
				GER = {
					remove_mission = GER_Faction_Join_Pakt_Mission
					country_event = { #Warning Event
						id = ENG_International_Mechanic.61
						hours = 20
					}
				}
				USA = {
					remove_mission = USA_Faction_Join_Pakt_Mission
					country_event = { #Warning Event
						id = ENG_International_Mechanic.60
						hours = 20
					}
				}
				ENG = {
					remove_mission = ENG_Faction_Join_Pakt_Mission
					country_event = { #Warning Event
						id = ENG_International_Mechanic.9
						hours = 20
					}
				}
			}
		}
	}
}


ENG_Decrease_Scottish_Terrorism = {
	if = {
		limit = {
			has_idea = ENG_Scottish_Civil_Unrest
		}
		remove_ideas = ENG_Scottish_Civil_Unrest
	}
	else_if = {
		limit = {
			has_idea = ENG_Scottish_Protests
		}
		swap_ideas = {
			remove_idea = ENG_Scottish_Protests
			add_idea = ENG_Scottish_Civil_Unrest
		}
		hidden_effect = {
			country_event = {
				id = ENG_Scotland_unification.34
				days = 480
			}
		}
	}
	else_if = {
		limit = {
			has_idea = ENG_Scottish_Riots
		}
		swap_ideas = {
			remove_idea = ENG_Scottish_Riots
			add_idea = ENG_Scottish_Protests
		}
		hidden_effect = {
			country_event = {
				id = ENG_Scotland_unification.34
				days = 480
			}
		}
	}
	else_if = {
		limit = {
			has_idea = ENG_Scottish_Resistance
		}
		swap_ideas = {
			remove_idea = ENG_Scottish_Resistance
			add_idea = ENG_Scottish_Riots
		}
		hidden_effect = {
			country_event = {
				id = ENG_Scotland_unification.34
				days = 360
			}
		}
	}
	else_if = {
		limit = {
			has_idea = ENG_Scottish_Terrorism
		}
		swap_ideas = {
			remove_idea = ENG_Scottish_Terrorism
			add_idea = ENG_Scottish_Resistance
		}
		hidden_effect = {
			country_event = {
				id = ENG_Scotland_unification.34
				days = 180
			}
		}
	}
	else_if = {
		limit = {
			has_country_flag = ENG_Scottish_Violent
		}
		add_ideas = ENG_Scottish_Terrorism
		hidden_effect = {
			country_event = {
				id = ENG_Scotland_unification.34
				days = 180
			}
		}
		hidden_effect = {
			ENG_Rejoin_faction_balance = yes
		}
	}

}

ENG_Decrease_Welsh_Terrorism = {
	if = {
		limit = {
			has_idea = ENG_Wales_Civil_Unrest
		}
		remove_ideas = ENG_Wales_Civil_Unrest
	}
	else_if = {
		limit = {
			has_idea = ENG_Wales_Protests
		}
		swap_ideas = {
			remove_idea = ENG_Wales_Protests
			add_idea = ENG_Wales_Civil_Unrest
		}
		hidden_effect = {
			country_event = {
				id = ENG_Wales_unification.16
				days = 360
			}
		}
	}
	else_if = {
		limit = {
			has_idea = ENG_Wales_Riots
		}
		swap_ideas = {
			remove_idea = ENG_Wales_Riots
			add_idea = ENG_Wales_Protests
		}
		hidden_effect = {
			country_event = {
				id = ENG_Wales_unification.16
				days = 360
			}
		}
	}
	else_if = {
		limit = {
			has_idea = ENG_Wales_Resistance
		}
		swap_ideas = {
			remove_idea = ENG_Wales_Resistance
			add_idea = ENG_Wales_Riots
		}
		hidden_effect = {
			country_event = {
				id = ENG_Wales_unification.16
				days = 360
			}
		}
	}
	else_if = {
		limit = {
			has_idea = ENG_Wales_Terrorism
		}
		swap_ideas = {
			remove_idea = ENG_Wales_Terrorism
			add_idea = ENG_Wales_Resistance
		}
		hidden_effect = {
			country_event = {
				id = ENG_Wales_unification.16
				days = 180
			}
		}
	}
	else_if = {
		limit = {
			has_country_flag = ENG_Wales_Violent
		}
		add_ideas = ENG_Wales_Terrorism
		hidden_effect = {
			country_event = {
				id = ENG_Wales_unification.16
				days = 180
			}
		}
	}
}

ENG_Kick_from_faction_balance = {
	if = {
		limit = {
			is_in_faction_with = USA
		}
		leave_faction = yes
		clear_superpower_embargoes = yes
		set_country_flag = ENG_Joined_OFN_Balance
		every_other_country = {
			limit = {
				is_in_faction_with = USA
			}
			diplomatic_relation = {
				country = ENG
				relation = military_access
				active = yes
			}
		}
	}
	if = {
		limit = {
			is_in_faction_with = GER
		}
		leave_faction = yes
		clear_superpower_embargoes = yes
		set_country_flag = ENG_Joined_PAKT_Balance
		every_other_country = {
			limit = {
				is_in_faction_with = GER
			}
			diplomatic_relation = {
				country = ENG
				relation = military_access
				active = yes
			}
		}
	}
}

ENG_Rejoin_faction_balance = {
	if = {
		limit = {
			ENG = {
				NOT = {
					has_war_with = WAL
					has_war_with = SCO
					has_war_with = GER
				}
			}
		}
		if = {
			limit = {
				has_country_flag = ENG_Joined_OFN_Balance
			}
			every_country = {
				limit = {
					is_in_faction_with = USA
				}
				diplomatic_relation = {
					country = ENG
					relation = military_access
					active = no
				}
			}
			USA = {
				add_to_faction = ENG
				set_temp_variable = { SeaZone_ID = 4 } # 4; North Sea
				Cold_War_GUI_PowerProjection_AddSeaZone = yes
			}
			clr_country_flag = ENG_Joined_OFN_Balance
		}
		if = {
			limit = {
				has_country_flag = ENG_Joined_PAKT_Balance
			}
			every_country = {
				limit = {
					is_in_faction_with = GER
				}
				diplomatic_relation = {
					country = ENG
					relation = military_access
					active = no
				}
			}
			GER = {
				add_to_faction = ENG
			}
			clr_country_flag = ENG_Joined_PAKT_Balance
		}
	}
}

ENG_focus_tree_swap_collab = {
	mark_focus_tree_layout_dirty = yes
}

ENG_focus_tree_swap_hmmlr = {
	mark_focus_tree_layout_dirty = yes
}


UE_INNER_POLITICS_CALC = {
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_UE_INNER_POLITICS1
				}
				check_variable = { ENG_Mac_Lovers < 0.01 }
			}
		}
		UE_INNER_POLITICS_IDEA_PURGE = yes
		add_ideas = ENG_UE_INNER_POLITICS1
		set_variable = {
			var = MAC_MECH_GOVTSTAB
			value = -0.125
		}
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_UE_INNER_POLITICS2
				}
				check_variable = { ENG_Mac_Lovers > 0 }
				check_variable = { ENG_Mac_Lovers < 0.11 }
			}
		}
		UE_INNER_POLITICS_IDEA_PURGE = yes
		add_ideas = ENG_UE_INNER_POLITICS2
		set_variable = {
			var = MAC_MECH_GOVTSTAB
			value = -0.1
		}
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_UE_INNER_POLITICS3
				}
				check_variable = { ENG_Mac_Lovers > 0.1 }
				check_variable = { ENG_Mac_Lovers < 0.21 }
			}
		}
		UE_INNER_POLITICS_IDEA_PURGE = yes
		add_ideas = ENG_UE_INNER_POLITICS3
		set_variable = {
			var = MAC_MECH_GOVTSTAB
			value = -0.08
		}
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_UE_INNER_POLITICS4
				}
				check_variable = { ENG_Mac_Lovers > 0.2 }
				check_variable = { ENG_Mac_Lovers < 0.31 }
			}
		}
		UE_INNER_POLITICS_IDEA_PURGE = yes
		add_ideas = ENG_UE_INNER_POLITICS4
		set_variable = {
			var = MAC_MECH_GOVTSTAB
			value = -0.06
		}
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_UE_INNER_POLITICS5
				}
				check_variable = { ENG_Mac_Lovers > 0.3 }
				check_variable = { ENG_Mac_Lovers < 0.41 }
			}
		}
		UE_INNER_POLITICS_IDEA_PURGE = yes
		add_ideas = ENG_UE_INNER_POLITICS5
		set_variable = {
			var = MAC_MECH_GOVTSTAB
			value = -0.04
		}
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_UE_INNER_POLITICS6
				}
				check_variable = { ENG_Mac_Lovers > 0.4 }
				check_variable = { ENG_Mac_Lovers < 0.5 }
			}
		}
		UE_INNER_POLITICS_IDEA_PURGE = yes
		add_ideas = ENG_UE_INNER_POLITICS6
		set_variable = {
			var = MAC_MECH_GOVTSTAB
			value = -0.02
		}
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_UE_INNER_POLITICS7
				}
				check_variable = { ENG_Mac_Lovers > 0.49 }
				check_variable = { ENG_Mac_Lovers < 0.51 }
			}
		}
		UE_INNER_POLITICS_IDEA_PURGE = yes
		add_ideas = ENG_UE_INNER_POLITICS7
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_UE_INNER_POLITICS8
				}
				check_variable = { ENG_Mac_Lovers > 0.5 }
				check_variable = { ENG_Mac_Lovers < 0.61 }
			}
		}
		UE_INNER_POLITICS_IDEA_PURGE = yes
		add_ideas = ENG_UE_INNER_POLITICS8
		set_variable = {
			var = MAC_MECH_GOVTSTAB
			value = 0.02
		}
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_UE_INNER_POLITICS9
				}
				check_variable = { ENG_Mac_Lovers > 0.6 }
				check_variable = { ENG_Mac_Lovers < 0.71 }
			}
		}
		UE_INNER_POLITICS_IDEA_PURGE = yes
		add_ideas = ENG_UE_INNER_POLITICS9
		set_variable = {
			var = MAC_MECH_GOVTSTAB
			value = 0.04
		}
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_UE_INNER_POLITICS10
				}
				check_variable = { ENG_Mac_Lovers > 0.7 }
				check_variable = { ENG_Mac_Lovers < 0.81 }
			}
		}
		UE_INNER_POLITICS_IDEA_PURGE = yes
		add_ideas = ENG_UE_INNER_POLITICS10
		set_variable = {
			var = MAC_MECH_GOVTSTAB
			value = 0.06
		}
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_UE_INNER_POLITICS11
				}
				check_variable = { ENG_Mac_Lovers > 0.8 }
				check_variable = { ENG_Mac_Lovers < 0.91 }
			}
		}
		UE_INNER_POLITICS_IDEA_PURGE = yes
		add_ideas = ENG_UE_INNER_POLITICS11
		set_variable = {
			var = MAC_MECH_GOVTSTAB
			value = 0.08
		}
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_UE_INNER_POLITICS12
				}
				check_variable = { ENG_Mac_Lovers > 0.9 }
				check_variable = { ENG_Mac_Lovers < 1 }
			}
		}
		UE_INNER_POLITICS_IDEA_PURGE = yes
		add_ideas = ENG_UE_INNER_POLITICS12
		set_variable = {
			var = MAC_MECH_GOVTSTAB
			value = 0.1
		}
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_UE_INNER_POLITICS13
				}
				check_variable = { ENG_Mac_Lovers > 0.99 }
			}
		}
		UE_INNER_POLITICS_IDEA_PURGE = yes
		add_ideas = ENG_UE_INNER_POLITICS13
		set_variable = {
			var = MAC_MECH_GOVTSTAB
			value = 0.125
		}
	}
	UE_INNER_POLITICS_GOVT_STAB_CALC = yes
}

UE_INNER_POLITICS_IDEA_PURGE = {
	remove_ideas = {
		ENG_UE_INNER_POLITICS1
		ENG_UE_INNER_POLITICS2
		ENG_UE_INNER_POLITICS3
		ENG_UE_INNER_POLITICS4
		ENG_UE_INNER_POLITICS5
		ENG_UE_INNER_POLITICS6
		ENG_UE_INNER_POLITICS7
		ENG_UE_INNER_POLITICS8
		ENG_UE_INNER_POLITICS9
		ENG_UE_INNER_POLITICS10
		ENG_UE_INNER_POLITICS11
		ENG_UE_INNER_POLITICS12
		ENG_UE_INNER_POLITICS13
	}
}

UE_INNER_POLITICS_GOVT_STAB_CALC = {
	add_to_variable = { ParliamentMechanic_GovStab = MAC_MECH_GOVTSTAB }
	subtract_from_variable = { ParliamentMechanic_GovStab = MAC_MECH_GOVTSTAB_OLD }
	clamp_variable = {
		var = ParliamentMechanic_GovStab
		min = 0
		max = 1
	}
	clear_variable = MAC_MECH_GOVTSTAB_OLD
	set_variable = {
		var = MAC_MECH_GOVTSTAB_OLD
		value = MAC_MECH_GOVTSTAB
	}
}


RP_POP_SPLIT_CALC = {
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_POP_SPLIT1
				}
				check_variable = { ENG_Populist_Lovers < 0.11 }
			}
		}
		RP_POP_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_POP_SPLIT1
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_POP_SPLIT2
				}
				check_variable = { ENG_Populist_Lovers > 0.1 }
				check_variable = { ENG_Populist_Lovers < 0.21 }
			}
		}
		RP_POP_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_POP_SPLIT2
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_POP_SPLIT3
				}
				check_variable = { ENG_Populist_Lovers > 0.2 }
				check_variable = { ENG_Populist_Lovers < 0.31 }
			}
		}
		RP_POP_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_POP_SPLIT3
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_POP_SPLIT4
				}
				check_variable = { ENG_Populist_Lovers > 0.3 }
				check_variable = { ENG_Populist_Lovers < 0.41 }
			}
		}
		RP_POP_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_POP_SPLIT4
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_POP_SPLIT5
				}
				check_variable = { ENG_Populist_Lovers > 0.4 }
				check_variable = { ENG_Populist_Lovers < 0.5 }
			}
		}
		RP_POP_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_POP_SPLIT5
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_POP_SPLIT6
				}
				check_variable = { ENG_Populist_Lovers > 0.49 }
				check_variable = { ENG_Populist_Lovers < 0.51 }
			}
		}
		RP_POP_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_POP_SPLIT6
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_POP_SPLIT7
				}
				check_variable = { ENG_Populist_Lovers > 0.5 }
				check_variable = { ENG_Populist_Lovers < 0.6 }
			}
		}
		RP_POP_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_POP_SPLIT7
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_POP_SPLIT8
				}
				check_variable = { ENG_Populist_Lovers > 0.59 }
				check_variable = { ENG_Populist_Lovers < 0.7 }
			}
		}
		RP_POP_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_POP_SPLIT8
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_POP_SPLIT9
				}
				check_variable = { ENG_Populist_Lovers > 0.69 }
				check_variable = { ENG_Populist_Lovers < 0.8 }
			}
		}
		RP_POP_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_POP_SPLIT9
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_POP_SPLIT10
				}
				check_variable = { ENG_Populist_Lovers > 0.79 }
				check_variable = { ENG_Populist_Lovers < 0.9 }
			}
		}
		RP_POP_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_POP_SPLIT10
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_POP_SPLIT11
				}
				check_variable = { ENG_Populist_Lovers > 0.89 }
			}
		}
		RP_POP_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_POP_SPLIT11
	}
}

RP_POP_SPLIT_IDEA_PURGE = {
	remove_ideas = {
		ENG_RP_POP_SPLIT1
		ENG_RP_POP_SPLIT2
		ENG_RP_POP_SPLIT3
		ENG_RP_POP_SPLIT4
		ENG_RP_POP_SPLIT5
		ENG_RP_POP_SPLIT6
		ENG_RP_POP_SPLIT7
		ENG_RP_POP_SPLIT8
		ENG_RP_POP_SPLIT9
		ENG_RP_POP_SPLIT10
		ENG_RP_POP_SPLIT11
	}
}

RP_ELITE_SPLIT_CALC = {
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_ELITE_SPLIT1
				}
				check_variable = { ENG_Elite_Lovers < 0.11 }
			}
		}
		RP_ELITE_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_ELITE_SPLIT1
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_ELITE_SPLIT2
				}
				check_variable = { ENG_Elite_Lovers > 0.1 }
				check_variable = { ENG_Elite_Lovers < 0.21 }
			}
		}
		RP_ELITE_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_ELITE_SPLIT2
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_ELITE_SPLIT3
				}
				check_variable = { ENG_Elite_Lovers > 0.2 }
				check_variable = { ENG_Elite_Lovers < 0.31 }
			}
		}
		RP_ELITE_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_ELITE_SPLIT3
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_ELITE_SPLIT4
				}
				check_variable = { ENG_Elite_Lovers > 0.3 }
				check_variable = { ENG_Elite_Lovers < 0.41 }
			}
		}
		RP_ELITE_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_ELITE_SPLIT4
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_ELITE_SPLIT5
				}
				check_variable = { ENG_Elite_Lovers > 0.4 }
				check_variable = { ENG_Elite_Lovers < 0.5 }
			}
		}
		RP_ELITE_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_ELITE_SPLIT5
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_ELITE_SPLIT6
				}
				check_variable = { ENG_Elite_Lovers > 0.49 }
				check_variable = { ENG_Elite_Lovers < 0.51 }
			}
		}
		RP_ELITE_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_ELITE_SPLIT6
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_ELITE_SPLIT7
				}
				check_variable = { ENG_Elite_Lovers > 0.5 }
				check_variable = { ENG_Elite_Lovers < 0.6 }
			}
		}
		RP_ELITE_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_ELITE_SPLIT7
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_ELITE_SPLIT8
				}
				check_variable = { ENG_Elite_Lovers > 0.59 }
				check_variable = { ENG_Elite_Lovers < 0.7 }
			}
		}
		RP_ELITE_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_ELITE_SPLIT8
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_ELITE_SPLIT9
				}
				check_variable = { ENG_Elite_Lovers > 0.69 }
				check_variable = { ENG_Elite_Lovers < 0.8 }
			}
		}
		RP_ELITE_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_ELITE_SPLIT9
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_ELITE_SPLIT10
				}
				check_variable = { ENG_Elite_Lovers > 0.79 }
				check_variable = { ENG_Elite_Lovers < 0.9 }
			}
		}
		RP_ELITE_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_ELITE_SPLIT10
	}
	if = {
		limit = {
			AND = {
				NOT = {
					has_idea = ENG_RP_ELITE_SPLIT11
				}
				check_variable = { ENG_Elite_Lovers > 0.89 }
			}
		}
		RP_ELITE_SPLIT_IDEA_PURGE = yes
		add_ideas = ENG_RP_ELITE_SPLIT11
	}
}

RP_ELITE_SPLIT_IDEA_PURGE = {
	remove_ideas = {
		ENG_RP_ELITE_SPLIT1
		ENG_RP_ELITE_SPLIT2
		ENG_RP_ELITE_SPLIT3
		ENG_RP_ELITE_SPLIT4
		ENG_RP_ELITE_SPLIT5
		ENG_RP_ELITE_SPLIT6
		ENG_RP_ELITE_SPLIT7
		ENG_RP_ELITE_SPLIT8
		ENG_RP_ELITE_SPLIT9
		ENG_RP_ELITE_SPLIT10
		ENG_RP_ELITE_SPLIT11
	}
}



### Pie chart update code. note: will erase any changes you make to the pop wheel unless specified otherwise e.g. NF trolling
### not the best code but it works

TotalPopCalc = {
	if = {
		limit = { has_global_flag = ENG_GF_WonEcw }
		set_variable = { ENG_multiplier = 1 }
		subtract_from_variable = { ENG_multiplier = ENG_mac_socdem }
		set_variable = { ENG_mac_socdem_added = ENG_mac_socdem }
		multiply_variable = { ENG_mac_socdem_added = 100 }
		set_variable = { ENG.TotalPop_Mac = 0 }
		every_owned_state = {
			add_to_variable = { ENG.TotalPop_Mac = ElectionSeason_State_PartyPop^0 }
		}
		set_variable = { ENG.TotalPop_Lib = 0 }
		every_owned_state = {
			add_to_variable = { ENG.TotalPop_Lib = ElectionSeason_State_PartyPop^1 }
		}
		set_variable = { ENG.TotalPop_RP = 0 }
		every_owned_state = {
			add_to_variable = { ENG.TotalPop_RP = ElectionSeason_State_PartyPop^2 }
		}
		set_variable = { ENG.TotalPop_NF = 0 }
		every_owned_state = {
			add_to_variable = { ENG.TotalPop_NF = ElectionSeason_State_PartyPop^3 }
		}
		set_variable = { ENG.TotalPop_All = 0 }
		add_to_variable = { ENG.TotalPop_All = ENG.TotalPop_Mac }
		add_to_variable = { ENG.TotalPop_All = ENG.TotalPop_Lib }
		add_to_variable = { ENG.TotalPop_All = ENG.TotalPop_RP }
		add_to_variable = { ENG.TotalPop_All = ENG.TotalPop_NF }

		divide_variable = { ENG.TotalPop_Mac = ENG.TotalPop_All }
		multiply_variable = { ENG.TotalPop_Mac = 100 }
		multiply_variable = { ENG.TotalPop_Mac = ENG_multiplier }
		round_variable = ENG.TotalPop_Mac

		divide_variable = { ENG.TotalPop_Lib = ENG.TotalPop_All }
		multiply_variable = { ENG.TotalPop_Lib = 100 }
		multiply_variable = { ENG.TotalPop_Lib = ENG_multiplier }
		round_variable = ENG.TotalPop_Lib

		divide_variable = { ENG.TotalPop_RP = ENG.TotalPop_All }
		multiply_variable = { ENG.TotalPop_RP = 100 }
		multiply_variable = { ENG.TotalPop_RP = ENG_multiplier }
		round_variable = ENG.TotalPop_RP

		divide_variable = { ENG.TotalPop_NF = ENG.TotalPop_All }
		multiply_variable = { ENG.TotalPop_NF = 100 }
		multiply_variable = { ENG.TotalPop_NF = ENG_multiplier }
		round_variable = ENG.TotalPop_NF

		set_variable = { ENG.remaining_pop = 100 }
		subtract_from_variable = { ENG.remaining_pop = ENG.TotalPop_Mac }
		subtract_from_variable = { ENG.remaining_pop = ENG.TotalPop_Lib }
		subtract_from_variable = { ENG.remaining_pop = ENG.TotalPop_RP }
		subtract_from_variable = { ENG.remaining_pop = ENG.TotalPop_NF }
		subtract_from_variable = { ENG.remaining_pop = ENG_mac_socdem_added }

		set_popularities = {
			conservatism = ENG.TotalPop_Mac
			progressivism = ENG_mac_socdem_added
			liberal_conservatism = ENG.TotalPop_Lib
			paternalism = ENG.TotalPop_RP
			fascism = ENG.TotalPop_NF
		}
		if = {
			limit = {
				has_completed_focus = ENG_NF_strange_bedfellows
			}
			set_temp_variable = { NF_troll_temp = ENG.TotalPop_NF }
			divide_temp_variable = { NF_troll_temp = 5 }
			set_temp_variable = { NF_troll_temp_2 = NF_troll_temp }
			multiply_temp_variable = { NF_troll_temp_2 = 2 }
			set_popularities = {
				conservatism = ENG.TotalPop_Mac
				progressivism = ENG_mac_socdem_added
				liberal_conservatism = ENG.TotalPop_Lib
				paternalism = ENG.TotalPop_RP
				fascism = NF_troll_temp_2
				ultranationalism = NF_troll_temp
				national_socialism = NF_troll_temp
			}
		}
	}

	if = {
		limit = { has_global_flag = FEN_GF_WonEcw }
		set_variable = { ENG.TotalPop_Whigs = 0 }
		every_owned_state = {
			add_to_variable = { ENG.TotalPop_Whigs = ElectionSeason_State_PartyPop^0 }
		}
		set_variable = { ENG.TotalPop_Democrats = 0 }
		every_owned_state = {
			add_to_variable = { ENG.TotalPop_Democrats = ElectionSeason_State_PartyPop^1 }
		}
		set_variable = { ENG.TotalPop_Patriots = 0 }
		every_owned_state = {
			add_to_variable = { ENG.TotalPop_Patriots = ElectionSeason_State_PartyPop^2 }
		}
		set_variable = { ENG.TotalPop_SLProgress = 0 }
		every_owned_state = {
			add_to_variable = { ENG.TotalPop_SLProgress = ElectionSeason_State_PartyPop^3 }
		}
		set_variable = { ENG.TotalPop_SLPollitites = 0 }
		every_owned_state = {
			add_to_variable = { ENG.TotalPop_SLPollitites = ElectionSeason_State_PartyPop^4 }
		}
		set_variable = { ENG.TotalPop_MSA = 0 }
		every_owned_state = {
			add_to_variable = { ENG.TotalPop_MSA = ElectionSeason_State_PartyPop^5 }
		}
		set_variable = { ENG.TotalPop_All = 0 }
		add_to_variable = { ENG.TotalPop_All = ENG.TotalPop_Whigs }
		add_to_variable = { ENG.TotalPop_All = ENG.TotalPop_Democrats }
		add_to_variable = { ENG.TotalPop_All = ENG.TotalPop_Patriots }
		add_to_variable = { ENG.TotalPop_All = ENG.TotalPop_SLProgress }
		add_to_variable = { ENG.TotalPop_All = ENG.TotalPop_SLPollitites }
		add_to_variable = { ENG.TotalPop_All = ENG.TotalPop_MSA }

		divide_variable = { ENG.TotalPop_Whigs = ENG.TotalPop_All }
		multiply_variable = { ENG.TotalPop_Whigs = 100 }
		round_variable = ENG.TotalPop_Whigs

		divide_variable = { ENG.TotalPop_Democrats = ENG.TotalPop_All }
		multiply_variable = { ENG.TotalPop_Democrats = 100 }
		round_variable = ENG.TotalPop_Democrats

		divide_variable = { ENG.TotalPop_Patriots = ENG.TotalPop_All }
		multiply_variable = { ENG.TotalPop_Patriots = 100 }
		round_variable = ENG.TotalPop_Patriots

		divide_variable = { ENG.TotalPop_SLProgress = ENG.TotalPop_All }
		multiply_variable = { ENG.TotalPop_SLProgress = 100 }
		round_variable = ENG.TotalPop_SLProgress

		divide_variable = { ENG.TotalPop_SLPollitites = ENG.TotalPop_All }
		multiply_variable = { ENG.TotalPop_SLPollitites = 100 }
		round_variable = ENG.TotalPop_SLPollitites

		divide_variable = { ENG.TotalPop_MSA = ENG.TotalPop_All }
		multiply_variable = { ENG.TotalPop_MSA = 100 }
		round_variable = ENG.TotalPop_MSA

		set_variable = { ENG.remaining_pop = 100 }
		subtract_from_variable = { ENG.remaining_pop = ENG.TotalPop_Whigs }
		subtract_from_variable = { ENG.remaining_pop = ENG.TotalPop_Democrats }
		subtract_from_variable = { ENG.remaining_pop = ENG.TotalPop_Patriots }
		subtract_from_variable = { ENG.remaining_pop = ENG.TotalPop_SLProgress }
		subtract_from_variable = { ENG.remaining_pop = ENG.TotalPop_SLPollitites }

		set_popularities = {
			conservatism = ENG.TotalPop_Democrats
			liberalism = ENG.TotalPop_Whigs
			paternalism = ENG.TotalPop_Patriots
			Socialist = ENG.TotalPop_SLProgress
			communist = ENG.TotalPop_SLPollitites
			despotism = ENG.remaining_pop
		}
	}
}

ENG_ECW_select_victor = { #Copy of GCW system

	#Meant to operate using a points based system, to attempt to gauge the prospective victor.

	#Collabs
	if = {
		limit = { country_exists = ENG }
		ENG = {
			set_variable = { ECW_manpower = num_divisions }
			set_variable = { ECW_equipment = num_equipment_in_armies_k@infantry_equipment }
			set_variable = { ECW_surrender_progress = surrender_progress }
		}
	}
	#HMMLR
	if = {
		limit = { country_exists = FEN }
		FEN = {
			set_variable = { ECW_manpower = num_divisions }
			set_variable = { ECW_equipment = num_equipment_in_armies_k@infantry_equipment }
			set_variable = { ECW_surrender_progress = surrender_progress }
		}
	}

	#Point distribution

	#Manpower
	if = {
		limit = {
			check_variable = { FEN.ECW_manpower > ENG.ECW_manpower }
		}
		add_to_variable = { FEN_points = 1 }
		else = {
			add_to_variable = { ENG_points = 1 }
		}
	}

	#Equipment
	if = {
		limit = {
			check_variable = { FEN.ECW_equipment > ENG.ECW_equipment }
		}
		add_to_variable = { FEN_points = 1 }
		else = {
			add_to_variable = { ENG_points = 1 }
		}
	}

	#Surrender progress
	if = {
		limit = {
			check_variable = { FEN.ECW_surrender_progress < ENG.ECW_surrender_progress }
		}
		add_to_variable = { FEN_points = 1 }
		else = {
			add_to_variable = { ENG_points = 1 }
		}
	}

	#Choosing the victor
	if = {
		limit = {
			check_variable = { ENG_points > FEN_points }
		}
		ENG = { add_ideas = ENG_CW_Victor }
		CRN = { add_ideas = ENG_CW_Victor }
		FEN = { add_ideas = ENG_CW_Loser }
	}
	else = {
		ENG = { add_ideas = ENG_CW_Loser }
		CRN = { add_ideas = ENG_CW_Loser }
		FEN = { add_ideas = ENG_CW_Victor }
	}
}

ENG_cornwall_setup = { #Everything that needs to be done after taking Cornwall
	log = "[GetDateText]: [Root.GetName]: ENG_cornwall_setup; Executing"
	if = {
		limit = {
			has_global_flag = ENG_Faction_Start_Flag
		}
		set_temp_variable = { EP_influence_temp = -10 }
		ENG_EP_Influence_Change = yes
	}
	else = {
		set_country_flag = ENG_defeated_cornwall
	}
	hidden_effect = {
		set_country_flag = ENG_cornwall_united
		TNO_Britain_ElectionSeason_Initialize_Cornwall_Collab = yes
		#hidden_effect = { CRN = { every_unit_leader = { set_nationality = GER } } }
	}
	log = "[GetDateText]: [Root.GetName]: ENG_cornwall_setup; Completed Execution."
}

ENG_wales_setup = { #Everything that needs to be done after taking Wales
	log = "[GetDateText]: [Root.GetName]: ENG_wales_setup; Executing"
	hidden_effect = {
		set_country_flag = ENG_wales_united

		# Election
		if = {
			limit = {
				has_global_flag = FEN_GF_WonEcw
			}
			TNO_Britain_ElectionSeason_Initialize_Wales_HMMLR = yes
		}
		else = {
			TNO_Britain_ElectionSeason_Initialize_Wales_Collab = yes
		}
		# Cosmetic tag
		if = {
			limit = {
				has_country_flag = ENG_government_republic
				NOT = { has_cosmetic_tag = ENG_commonwealth_england_and_wales }
				NOT = { has_cosmetic_tag = ENG_commonwealth_britain_old }
			}
			drop_cosmetic_tag = yes
			set_cosmetic_tag = ENG_commonwealth_england_and_wales
		}
		else_if = {
			limit = {
				has_country_flag = ENG_macmillan_victorious
			}
			#nothing happens
		}
		else_if = {
			limit = {
				NOT = { has_cosmetic_tag = ENG_england_and_wales }
				NOT = { has_cosmetic_tag = ENG_united_kingdom }
				NOT = { has_cosmetic_tag = ENG_free }
				NOT = { has_cosmetic_tag = ENG_free_england_and_wales }
			}
			drop_cosmetic_tag = yes
			set_cosmetic_tag = ENG_england_and_wales
		}
		else_if = {
			limit = {
				NOT = { has_cosmetic_tag = ENG_free_england_and_wales }
				NOT = { has_cosmetic_tag = ENG_united_kingdom }
				has_cosmetic_tag = ENG_free
			}
			drop_cosmetic_tag = yes
			set_cosmetic_tag = ENG_free_england_and_wales
		}

		SCO = { remove_ideas = SCO_RentedScotland }
	}
	# Resistance
	if = {
		limit = {
			has_country_flag = ENG_Wales_Violent
		}
		ENG_Decrease_Welsh_Terrorism = yes
		every_country = {
			limit = { is_ai = no }
			news_event = {
				id = WORLD.50006
				days = 1
			}
		}
	}
	else = {
		add_state_core = 1301
		add_state_core = 122
		add_state_core = 1999
		add_ideas = ENG_Wales_Riots
		hidden_effect = {
			country_event = {
				id = ENG_Wales_unification.16
				days = 360
			}
			every_country = {
				limit = { is_ai = no }
				news_event = {
					id = WORLD.50005
					days = 1
				}
			}
		}
		WAL = {
			every_unit_leader = {
				set_nationality = ENG
			}
		}
	}
	ENG_Rejoin_faction_balance = yes
	log = "[GetDateText]: [Root.GetName]: ENG_wales_setup; Completed Execution."
}

ENG_scotland_setup = { #Everything that needs to be done after taking Scotland
	log = "[GetDateText]: [Root.GetName]: ENG_scotland_setup; Executing"
	hidden_effect = {
		set_country_flag = ENG_scotland_united
		set_global_flag = ENG_united_kingdom_GF

		# Election
		if = {
			limit = {
				has_global_flag = FEN_GF_WonEcw
			}
			TNO_Britain_ElectionSeason_Initialize_Scotland_HMMLR = yes
		}
		else = {
			TNO_Britain_ElectionSeason_Initialize_Scotland_Collab = yes
		}
		# Cosmetic tag
		if = {
			limit = {
				has_country_flag = ENG_government_republic
				NOT = { has_cosmetic_tag = ENG_commonwealth_britain_old }
			}
			drop_cosmetic_tag = yes
			set_cosmetic_tag = ENG_commonwealth_britain_old
		}
		else_if = {
			limit = {
				NOT = { has_cosmetic_tag = ENG_united_kingdom }
			}
			drop_cosmetic_tag = yes
			set_cosmetic_tag = ENG_united_kingdom
		}
	}
	# Resistance
	if = {
		limit = {
			has_country_flag = ENG_Scottish_Violent
		}
		country_event = {
			id = ENG_Scotland_unification.34
			days = 1
		}
		every_country = {
			limit = { is_ai = no }
			news_event = {
				id = WORLD.50009
				days = 1
			}
		}
	}
	else = {
		if = {
			limit = {
				NOT = {
					has_idea = ENG_Scottish_Terrorism
					has_idea = ENG_Scottish_Resistance
					has_idea = ENG_Scottish_Riots
					has_idea = ENG_Scottish_Protests
					has_idea = ENG_Scottish_Civil_Unrest
				}
			}
			add_state_core = 1322
			add_state_core = 120
			add_state_core = 136
			add_state_core = 1320
			add_state_core = 133
			add_state_core = 1321
			add_state_core = 121
			add_ideas = ENG_Scottish_Riots
			hidden_effect = {
				country_event = {
					id = ENG_Scotland_unification.34
					days = 360
				}
			}
		}
		SCO = {
			every_unit_leader = {
				set_nationality = ENG
			}
		}
		hidden_effect = {
			every_country = {
				limit = { is_ai = no }
				news_event = {
					id = WORLD.50010
					days = 1
				}
			}
		}
	}
	ENG_Rejoin_faction_balance = yes
	log = "[GetDateText]: [Root.GetName]: ENG_scotland_setup; Completed Execution."
}

ENG_AI_Next_UE_Dec = {
	if = {
		limit = {
			OR = {
				AND = {
					has_country_flag = ENG_mac_shadowmaster
					check_variable = { ENG_Mac_Lovers = 1 }
				}
				AND = {
					has_country_flag = ENG_mac_liberal
					check_variable = { ENG_Lib_Lovers = 1 }
				}
			}
		}
		set_variable = { ENG_Next_UE_Dec^0 = 0 }
		set_variable = { ENG_Next_UE_Dec^3 = 0 }
		if = {
			limit = {
				check_variable = { ENG_MIL_LOY > 99 }
			}
			set_variable = { ENG_Next_UE_Dec^4 = 0 }
		}
		else = {
			set_variable = { ENG_Next_UE_Dec^4 = 5 }
		}
		if = {
			limit = {
				OR = {
					AND = {
						has_country_flag = ENG_mac_shadowmaster
						check_variable = { ENG_democratization_process = 0 }
					}
					AND = {
						has_country_flag = ENG_mac_liberal
						check_variable = { ENG_democratization_process = 100 }
					}
				}
			}
			set_variable = { ENG_Next_UE_Dec^1 = 0 }
			if = {
				limit = {
					has_country_flag = ENG_mac_liberal
				}
				set_variable = { ENG_Next_UE_Dec^5 = 0 }
			}
			else = {
				set_variable = { ENG_Next_UE_Dec^5 = 5 }
			}
		}
		else = {
			set_variable = { ENG_Next_UE_Dec^1 = 5 }
			set_variable = { ENG_Next_UE_Dec^5 = 5 }
		}
	}
	else = { # No need to re-add ENG_Next_UE_Dec^3
		set_variable = { ENG_Next_UE_Dec^0 = 5 }
		set_variable = { ENG_Next_UE_Dec^1 = 5 }
		set_variable = { ENG_Next_UE_Dec^4 = 5 }
		set_variable = { ENG_Next_UE_Dec^5 = 5 }
	}
	if = {
		limit = {
			check_variable = { ENG_MIL_LOY > 99 }
		}
		set_variable = { ENG_Next_UE_Dec^6 = 0 }
	}
	else = {
		set_variable = { ENG_Next_UE_Dec^6 = 5 }
	}
	if = {
		limit = {
			check_variable = { ENG_MIL_EFF > 99 }
		}
		set_variable = { ENG_Next_UE_Dec^7 = 0 }
	}
	else = {
		set_variable = { ENG_Next_UE_Dec^7 = 5 }
	}
	random_list = {
		ENG_Next_UE_Dec^0 = {
			set_variable = { ENG_Next_UE_Dec_R = 1 }
			log = "[GetDateText]: [Root.GetName]: ENG_AI_Next_UE_Dec; Result 1"
		}
		ENG_Next_UE_Dec^0 = {
			set_variable = { ENG_Next_UE_Dec_R = 2 }
			log = "[GetDateText]: [Root.GetName]: ENG_AI_Next_UE_Dec; Result 2"
		}
		ENG_Next_UE_Dec^1 = {
			set_temp_variable = { ENG_Lib_Lovers_Percent = ENG_Lib_Lovers }
			multiply_temp_variable = { ENG_Lib_Lovers_Percent = 100 }
			if = {
				limit = {
					check_variable = { ENG_democratization_process < ENG_Lib_Lovers_Percent }
				}
				set_variable = { ENG_Next_UE_Dec_R = 3 }
				log = "[GetDateText]: [Root.GetName]: ENG_AI_Next_UE_Dec; Result 3"
			}
			else_if = {
				limit = {
					check_variable = { ENG_democratization_process > ENG_Lib_Lovers_Percent }
				}
				set_variable = { ENG_Next_UE_Dec_R = 4 }
				log = "[GetDateText]: [Root.GetName]: ENG_AI_Next_UE_Dec; Result 4"
			}
			else = {
				set_variable = { ENG_Next_UE_Dec_R = 1 }
				log = "[GetDateText]: [Root.GetName]: ENG_AI_Next_UE_Dec; Result 3,4 to 1"
			}
		}
		ENG_Next_UE_Dec^2 = {
			set_variable = { ENG_Next_UE_Dec_R = 5 }
			log = "[GetDateText]: [Root.GetName]: ENG_AI_Next_UE_Dec; Result 5"
		}
		ENG_Next_UE_Dec^3 = {
			set_variable = { ENG_Next_UE_Dec_R = 6 }
			set_variable = { ENG_Next_UE_Dec^3 = 0 }
			log = "[GetDateText]: [Root.GetName]: ENG_AI_Next_UE_Dec; Result 6"
		}
		ENG_Next_UE_Dec^4 = {
			set_variable = { ENG_Next_UE_Dec_R = 7 }
			log = "[GetDateText]: [Root.GetName]: ENG_AI_Next_UE_Dec; Result 7"
		}
		ENG_Next_UE_Dec^5 = {
			set_variable = { ENG_Next_UE_Dec_R = 8 }
			log = "[GetDateText]: [Root.GetName]: ENG_AI_Next_UE_Dec; Result 8"
		}
		ENG_Next_UE_Dec^6 = {
			set_variable = { ENG_Next_UE_Dec_R = 9 }
			log = "[GetDateText]: [Root.GetName]: ENG_AI_Next_UE_Dec; Result 9"
		}
		ENG_Next_UE_Dec^6 = {
			set_variable = { ENG_Next_UE_Dec_R = 10 }
			log = "[GetDateText]: [Root.GetName]: ENG_AI_Next_UE_Dec; Result 10"
		}
		ENG_Next_UE_Dec^7 = {
			set_variable = { ENG_Next_UE_Dec_R = 11 }
			log = "[GetDateText]: [Root.GetName]: ENG_AI_Next_UE_Dec; Result 11"
		}
		ENG_Next_UE_Dec^7 = {
			set_variable = { ENG_Next_UE_Dec_R = 12 }
			log = "[GetDateText]: [Root.GetName]: ENG_AI_Next_UE_Dec; Result 12"
		}
	}
}

#Cornwall MECHANIC

ENG_initialize_cornwall_mechanic = {
	set_variable = { ENG_Cornwall_State = 2 }
	set_variable = { ENG_Cornwall_Happiness = 3 }
	set_country_flag = ENG_cornwall_mechanic
	set_variable = { ENG_CRN_Planning = -0.10 }
	set_variable = { ENG_CRN_Org = -0.10 }
	set_variable = { ENG_CRN_Morale = -0.10 }
	set_variable = { ENG_CRN_Attack = -0.10 }
	set_variable = { ENG_CRN_Defense = -0.10 }
	set_variable = { ENG_CRN_Speed = -0.10 }
	set_variable = { cornwall_demand_swap = 1 }
	set_variable = { cornwall_started_demand = 0 }
	set_variable = { ENG_Cornwall_Counter = 0 }
}

ENG_update_cornwall_mechanic = {
	clamp_variable = {
		var = Cornwall_Happiness
		min = -20
		max = 10
	}
	if = {
		limit = {
			check_variable = { Cornwall_Happiness > 5 }
		}
		set_variable = { ENG_Cornwall_State = 3 }
	}
	else_if = {
		limit = {
			check_variable = { Cornwall_Happiness > 0 }
		}
		set_variable = { ENG_Cornwall_State = 2 }
	}
	else_if = {
		limit = {
			check_variable = { Cornwall_Happiness > -5 }
		}
		set_variable = { ENG_Cornwall_State = 1 }
	}
	else = {
		set_variable = { ENG_Cornwall_State = 0 }
	}

	add_to_variable = { ENG_Cornwall_Counter = 1 }

	log = "[GetDateText]: [Root.GetName]: ENG_update_cornwall_mechanic; Completed Execution. Current Happiness: [?Cornwall_Happiness]"
	if = {
		limit = { check_variable = { ENG_Cornwall_Counter = 7 } }
		divide_variable = { Cornwall_Happiness = 2 }
		round_variable = Cornwall_Happiness
		divide_variable = { Cornwall_Happiness = 100 }
		if = {
			limit = { check_variable = { ENG_Cornwall_State > 1 } }
			country_event = ENG_Cornwall.5
		}
		else = {
			country_event = ENG_Cornwall.4
		}
		log = "[GetDateText]: [Root.GetName]: ENG_update_cornwall_mechanic; All Completed."
	}
}

###TT Stuff
ENG_increase_business_tax_2 = {
	add_to_variable = { business_tax_rate = 0.02 }
	custom_effect_tooltip = ENG_increase_business_tax_2_percent
}

ENG_reduce_business_tax_1 = {
	subtract_from_variable = { business_tax_rate = 0.01 }
	custom_effect_tooltip = ENG_reduce_business_tax_1_percent
}

ENG_reduce_income_tax_3 = {
	subtract_from_variable = { business_tax_rate = 0.03 }
	custom_effect_tooltip = ENG_reduce_income_tax_3_percent
}

ENG_randomize_state_stab_sprt = {
	every_owned_state = {
		limit = {
			is_demilitarized_zone = no
		}
		randomize_variable = {
			var = ENG_StateStats_HmmlrSupport
			distribution = binomial
			min = 0
			max = 100
		}
		randomize_variable = {
			var = ENG_StateStats_Stability
			distribution = binomial
			min = 0
			max = 20
		}
		round_variable = ENG_StateStats_Stability
		multiply_variable = { ENG_StateStats_Stability = 5 }
	}
}

ENG_Collab_max = {
	every_owned_state = {
		limit = {
			is_demilitarized_zone = no
		}
		set_variable = { ENG_StateStats_HmmlrSupport = 5 }
	}
}

ENG_HMMLR_max = {
	every_owned_state = {
		limit = {
			is_demilitarized_zone = no
		}
		set_variable = { ENG_StateStats_HmmlrSupport = 95 }
	}
}

ENG_initialize_operations = {
	resize_array = {
		array = ENG_OP_Array
		value = 1
		size = 6
	}
}

ENG_OP_Select = {
	if = {
		limit = { check_variable = { ENG_OP_Selected = 0 } }
		set_variable = { ENG_gun_divider = 1 }
		set_variable = { ENG_operation_state = 1300 }
	}
	else_if = {
		limit = { check_variable = { ENG_OP_Selected = 1 } }
		set_variable = { ENG_gun_divider = 1 }
		set_variable = { ENG_operation_state = 131 }
	}
	else_if = {
		limit = { check_variable = { ENG_OP_Selected = 2 } }
		set_variable = { ENG_gun_divider = 1 }
		set_variable = { ENG_operation_state = 126 }
	}
	else_if = {
		limit = { check_variable = { ENG_OP_Selected = 3 } }
		set_variable = { ENG_gun_divider = 1 }
		set_variable = { ENG_operation_state = 125 }
	}
	else_if = {
		limit = { check_variable = { ENG_OP_Selected = 4 } }
		set_variable = { ENG_gun_divider = 1 }
		set_variable = { ENG_operation_state = 132 }
	}
	else_if = {
		limit = { check_variable = { ENG_OP_Selected = 5 } }
		set_variable = { ENG_gun_divider = 1.5 }
		set_variable = { ENG_operation_state = 127 }
	}
}

ENG_evaluate_mission_chance = {
	# Gun Effectiveness, depending on how many guns, operation type
	set_variable = { ENG_calc_guns = ENG_Operation_Guns }
	divide_variable = { ENG_calc_guns = ENG_gun_divider }

	#Apply the state stability effect, f(x)=300/(x+100)-1
	set_temp_variable = { ENG_calc_stab = ENG_operation_state:ENG_StateStats_Stability }
	add_to_temp_variable = { ENG_calc_stab = 100 }
	set_variable = { ENG_gun_eff = 300 }
	divide_variable = { ENG_gun_eff = ENG_calc_stab }
	subtract_from_variable = { ENG_gun_eff = 1 }
	multiply_variable = { ENG_calc_guns = ENG_gun_eff }

	#HMMLR Support
	set_variable = { ENG_calc_supp = ENG_operation_state:ENG_StateStats_HmmlrSupport }

	#f1(x,y) = (150x-40000)/(x+y+140)+105
	set_temp_variable = { ENG_mission_var1 = ENG_calc_supp } #x
	multiply_temp_variable = { ENG_mission_var1 = 150 } #150x
	subtract_from_temp_variable = { ENG_mission_var1 = 40000 } #150x-40000
	set_temp_variable = { ENG_mission_var2 = ENG_calc_supp } #x
	add_to_temp_variable = { ENG_mission_var2 = ENG_calc_guns } #x+y
	add_to_temp_variable = { ENG_mission_var2 = 140 } #x+y+140
	divide_temp_variable = { ENG_mission_var1 = ENG_mission_var2 } #(150x-40000)/(x+y+140)
	add_to_temp_variable = { ENG_mission_var1 = 105 } #(150x-40000)/(x+y+140)+105
	clamp_temp_variable = {
		var = ENG_mission_var1
		min = 0
		max = 100
	}

	#f2(x,y) = (180x-120000)/(x+y+530)+116
	set_temp_variable = { ENG_mission_var3 = ENG_calc_supp } #x
	multiply_temp_variable = { ENG_mission_var3 = 180 } #180x
	subtract_from_temp_variable = { ENG_mission_var3 = 120000 } #150x-120000
	add_to_temp_variable = { ENG_mission_var2 = 390 } #x+y+530
	divide_temp_variable = { ENG_mission_var3 = ENG_mission_var2 } #(150x-120000)/(x+y+530)
	add_to_temp_variable = { ENG_mission_var3 = 116 } #(180x-120000)/(x+y+530)+116
	clamp_temp_variable = {
		var = ENG_mission_var3
		min = 0
		max = 100
	}

	round_temp_variable = ENG_mission_var1
	round_temp_variable = ENG_mission_var3

	# P1 = f2(x,y)
	set_variable = { ENG_mission_prob1 = ENG_mission_var3 }

	# P2 = f1(x,y)-f2(x,y)
	set_variable = { ENG_mission_prob2 = ENG_mission_var1 }
	subtract_from_variable = { ENG_mission_prob2 = ENG_mission_var3 }

	# P3 = 100-f1(x,y)
	set_variable = { ENG_mission_prob3 = 100 }
	subtract_from_variable = { ENG_mission_prob3 = ENG_mission_var1 }
}

ENG_pick_next_focus_effect = {
	add_to_array = { ENG_focus_array = ENG_focus_id }
	hidden_effect = {
		random_list = {
			0 = {
				set_variable = { ENG_focus_id = 1 }
				modifier = {
					add = 20
					NOT = { is_in_array = { ENG_focus_array = 1 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 2 }
				modifier = {
					add = 10
					is_in_array = { ENG_focus_array = 1 }
					NOT = { is_in_array = { ENG_focus_array = 2 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 3 }
				modifier = {
					add = 10
					is_in_array = { ENG_focus_array = 1 }
					NOT = { is_in_array = { ENG_focus_array = 3 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 4 }
				modifier = {
					add = 5
					is_in_array = { ENG_focus_array = 2 }
					is_in_array = { ENG_focus_array = 3 }
					NOT = { is_in_array = { ENG_focus_array = 4 } }
					NOT = { is_in_array = { ENG_focus_array = 11 } }
					NOT = { is_in_array = { ENG_focus_array = 18 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 5 }
				modifier = {
					add = 10
					OR = {
						is_in_array = { ENG_focus_array = 4 }
						is_in_array = { ENG_focus_array = 11 }
						is_in_array = { ENG_focus_array = 18 }
					}
					NOT = { is_in_array = { ENG_focus_array = 5 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 6 }
				modifier = {
					add = 10
					OR = {
						is_in_array = { ENG_focus_array = 4 }
						is_in_array = { ENG_focus_array = 11 }
						is_in_array = { ENG_focus_array = 18 }
					}
					NOT = { is_in_array = { ENG_focus_array = 6 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 7 }
				modifier = {
					add = 10
					is_in_array = { ENG_focus_array = 5 }
					is_in_array = { ENG_focus_array = 6 }
					NOT = { is_in_array = { ENG_focus_array = 7 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 8 }
				modifier = {
					add = 20
					NOT = { is_in_array = { ENG_focus_array = 8 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 9 }
				modifier = {
					add = 10
					is_in_array = { ENG_focus_array = 8 }
					NOT = { is_in_array = { ENG_focus_array = 9 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 10 }
				modifier = {
					add = 10
					is_in_array = { ENG_focus_array = 8 }
					NOT = { is_in_array = { ENG_focus_array = 10 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 11 }
				modifier = {
					add = 5
					is_in_array = { ENG_focus_array = 9 }
					is_in_array = { ENG_focus_array = 10 }
					NOT = { is_in_array = { ENG_focus_array = 4 } }
					NOT = { is_in_array = { ENG_focus_array = 11 } }
					NOT = { is_in_array = { ENG_focus_array = 18 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 12 }
				modifier = {
					add = 10
					OR = {
						is_in_array = { ENG_focus_array = 4 }
						is_in_array = { ENG_focus_array = 11 }
						is_in_array = { ENG_focus_array = 18 }
					}
					NOT = { is_in_array = { ENG_focus_array = 12 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 13 }
				modifier = {
					add = 10
					OR = {
						is_in_array = { ENG_focus_array = 4 }
						is_in_array = { ENG_focus_array = 11 }
						is_in_array = { ENG_focus_array = 18 }
					}
					NOT = { is_in_array = { ENG_focus_array = 13 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 14 }
				modifier = {
					add = 10
					is_in_array = { ENG_focus_array = 12 }
					is_in_array = { ENG_focus_array = 13 }
					NOT = { is_in_array = { ENG_focus_array = 14 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 15 }
				modifier = {
					add = 20
					NOT = { is_in_array = { ENG_focus_array = 15 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 16 }
				modifier = {
					add = 10
					is_in_array = { ENG_focus_array = 15 }
					NOT = { is_in_array = { ENG_focus_array = 16 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 17 }
				modifier = {
					add = 10
					is_in_array = { ENG_focus_array = 15 }
					NOT = { is_in_array = { ENG_focus_array = 17 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 18 }
				modifier = {
					add = 5
					is_in_array = { ENG_focus_array = 16 }
					is_in_array = { ENG_focus_array = 17 }
					NOT = { is_in_array = { ENG_focus_array = 4 } }
					NOT = { is_in_array = { ENG_focus_array = 11 } }
					NOT = { is_in_array = { ENG_focus_array = 18 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 19 }
				modifier = {
					add = 10
					OR = {
						is_in_array = { ENG_focus_array = 4 }
						is_in_array = { ENG_focus_array = 11 }
						is_in_array = { ENG_focus_array = 18 }
					}
					NOT = { is_in_array = { ENG_focus_array = 19 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 20 }
				modifier = {
					add = 10
					OR = {
						is_in_array = { ENG_focus_array = 4 }
						is_in_array = { ENG_focus_array = 11 }
						is_in_array = { ENG_focus_array = 18 }
					}
					NOT = { is_in_array = { ENG_focus_array = 20 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 21 }
				modifier = {
					add = 10
					is_in_array = { ENG_focus_array = 19 }
					is_in_array = { ENG_focus_array = 20 }
					NOT = { is_in_array = { ENG_focus_array = 21 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 22 }
				modifier = {
					add = 10
					is_in_array = { ENG_focus_array = 7 }
					is_in_array = { ENG_focus_array = 14 }
					is_in_array = { ENG_focus_array = 21 }
					NOT = { is_in_array = { ENG_focus_array = 22 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 23 }
				modifier = {
					add = 10
					is_in_array = { ENG_focus_array = 7 }
					is_in_array = { ENG_focus_array = 14 }
					is_in_array = { ENG_focus_array = 21 }
					NOT = { is_in_array = { ENG_focus_array = 23 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 24 }
				modifier = {
					add = 10
					OR = {
						is_in_array = { ENG_focus_array = 22 }
						is_in_array = { ENG_focus_array = 23 }
					}
					NOT = { is_in_array = { ENG_focus_array = 24 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 25 }
				modifier = {
					add = 1
					is_in_array = { ENG_focus_array = 24 }
					NOT = { is_in_array = { ENG_focus_array = 25 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 26 }
				modifier = {
					add = 1
					is_in_array = { ENG_focus_array = 25 }
					NOT = { is_in_array = { ENG_focus_array = 26 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 27 }
				modifier = {
					add = 1
					is_in_array = { ENG_focus_array = 26 }
					NOT = { is_in_array = { ENG_focus_array = 27 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 28 }
				modifier = {
					add = 1
					is_in_array = { ENG_focus_array = 27 }
					NOT = { is_in_array = { ENG_focus_array = 28 } }
				}
			}
			0 = {
				set_variable = { ENG_focus_id = 29 }
				modifier = {
					add = 1
					is_in_array = { ENG_focus_array = 28 }
					NOT = { is_in_array = { ENG_focus_array = 29 } }
				}
			}
		}
	}
	add_to_variable = { ENG_focus_counter = 1 }
}