###########################
# South Africa Focus Tree
# By Thomahawk2k and Maltese
###########################

focus_tree = {
	id = SAF_focus

	country = {
		factor = 0

		modifier = {
			add = 10
			tag = SAF
		}
	}

	reset_on_civilwar = no
	default = no
	continuous_focus_position = { x = 100 y = 950 }

	focus = {
		id = SAF_black_monday_crisis
		icon = GFX_blackmondayhitstherand
		x = 1
		y = 0
		cost = 2
		cancelable = no
		available = {
			has_idea = SAF_black_monday_0
		}
		select_effect = {
			country_event = { id = saf.4 days = 0 }
			add_stability = 0.05
		}

		ai_will_do = {
			factor = 500
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_black_monday_crisis"
			custom_effect_tooltip = SWE_tt_fix_black_monday_decisions
			hidden_effect = {
				if = {
					limit = {
						is_ai = no
					}
					set_variable = { saf_var_budget = 4 }
					set_variable = { saf_var_inflation = 0 }
					set_variable = { saf_var_unemployment = 0.3 }
					clamp_variable = {
						var = saf_var_unemployment
						min = 0
						max = 1
					}
					set_variable = { saf_var_debt = 0 }
				}
			}
		}
		search_filters = { FOCUS_FILTER_INDUSTRY }
	}
	
	focus = {
		id = SAF_repeal_industrial_conciliation_act
		icon = GFX_workersuniteforawhitesouthafrica
		x = -1
		y = 1
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		available = {
			NOT = {
				has_country_flag = saf_flag_lack_majority_volksraad
				has_country_flag = saf_flag_gave_in_to_strikers
			}
			OR = {
				has_government = social_liberal
				has_government = market_liberal
				has_government = social_conservative
			}
		}
		select_effect = {
			country_event = { id = saf.14 days = 3 }
		}
		
		mutually_exclusive = {
			focus = SAF_establish_work_programs
		}
		prerequisite = {
			focus = SAF_black_monday_crisis
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_repeal_industrial_conciliation_act"
			unlock_decision_tooltip = SAF_soften_the_colour_bar
		}
		search_filters = { FOCUS_FILTER_INDUSTRY FOCUS_FILTER_POLITICAL }
	}

	focus = {
		id = SAF_attract_canadian_investment
		icon = GFX_goal_canada
		x = -1
		y = 2
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		
		prerequisite = {
			focus = SAF_repeal_industrial_conciliation_act
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_attract_canadian_investment"
			ENT = { country_event = { id = saf.23 days = 1 } }
		}
		search_filters = { FOCUS_FILTER_INDUSTRY }
	}
	
	focus = {
		id = SAF_weaken_the_colour_bar
		icon = GFX_goal_BUL_tackle_unemployment
		x = 0
		y = 3
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		available = {
			custom_trigger_tooltip = {
				tooltip = saf_tt_unemployment_below_16
				check_variable = {
					var = saf_var_unemployment
					value = 0.16
					compare = less_than_or_equals
				}
			}
		}
		bypass = {
			has_country_flag = SAF_black_monday_over
		}

		prerequisite = {
			focus = SAF_attract_canadian_investment
			focus = SAF_bail_out_farmers
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_weaken_the_colour_bar"
			swap_ideas = { add_idea = SAF_black_monday_1 remove_idea = SAF_black_monday_0 }
		}
		search_filters = { FOCUS_FILTER_INDUSTRY }
	}
	
	focus = {
		id = SAF_invest_in_witwatersrand_industry
		icon = GFX_openforbusiness
		x = 0
		y = 4
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		available = {
			custom_trigger_tooltip = {
				tooltip = saf_tt_unemployment_below_12
				check_variable = {
					var = saf_var_unemployment
					value = 0.12
					compare = less_than_or_equals
				}
			}
		}
		bypass = {
			has_country_flag = SAF_black_monday_over
		}

		prerequisite = {
			focus = SAF_weaken_the_colour_bar
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_invest_in_witwatersrand_industry"
			swap_ideas = { add_idea = SAF_black_monday_2 remove_idea = SAF_black_monday_1 }
		}
		search_filters = { FOCUS_FILTER_INDUSTRY }
	}
	
	focus = {
		id = SAF_establish_work_programs
		icon = GFX_promiseworkerprotection
		x = 1
		y = 1
		cost = 5
		relative_position_id = SAF_black_monday_crisis
		cancelable = no

		ai_will_do = {
			factor = 100
		}
		select_effect = {
			country_event = {
				id = saf.5
				days = 7
			}
		}
		available = {
			NOT = {
				has_country_flag = saf_flag_lack_majority_volksraad
			}
		}
		
		mutually_exclusive = {
			focus = SAF_repeal_industrial_conciliation_act
		}
		prerequisite = {
			focus = SAF_black_monday_crisis
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_establish_work_programs"
			unlock_decision_tooltip = SAF_public_work_program
			random_owned_state = {
				prioritize = {
					545
				}
				add_building_construction = {
					type = infrastructure
					level = 2
					instant_build = yes
				}
			}
			random_owned_state = {
				prioritize = {
					945
				}
				add_building_construction = {
					type = infrastructure
					level = 2
					instant_build = yes
				}
			}
		}
		search_filters = { FOCUS_FILTER_INDUSTRY }
	}
	
	focus = {
		id = SAF_bail_out_farmers
		icon = GFX_afrikanersocialsecurity
		x = 1
		y = 2
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		
		prerequisite = {
			focus = SAF_establish_work_programs
		}
#		mutually_exclusive = {
#			focus = SAF_encourage_farmer_resettlement
#		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_bail_out_farmers"
			add_timed_idea = {
				idea = SAF_farmer_bailout
				days = 180
			}
			add_stability = 0.05
		}
		search_filters = { FOCUS_FILTER_INDUSTRY }
	}
	
	focus = {
		id = SAF_complete_recovery
		icon = GFX_goal_BUL_rectify_economic_mistakes
		x = 0
		y = 5
		cost = 5
		relative_position_id = SAF_black_monday_crisis
		available = {
			OR = {
				AND = {
				custom_trigger_tooltip = {
					tooltip = SWE_tt_no_extreme_inflation
					check_variable = {
						var = saf_var_inflation
						value = 0.08
						compare = less_than
					}
				}
				custom_trigger_tooltip = {
					tooltip = SAF_tt_no_extreme_debt
					check_variable = {
						var = saf_var_debt
						value = 10
						compare = less_than
					}
				}
				custom_trigger_tooltip = {
					tooltip = saf_tt_unemployment_below_8
					check_variable = {
						var = saf_var_unemployment
						value = 0.08
						compare = less_than_or_equals
					}
				}
			}
			date > 1939.01.01
			}
		}
		bypass = {
			has_country_flag = SAF_black_monday_over
		}

		ai_will_do = {
			factor = 250
		}

		prerequisite = {
#			focus = SAF_sa_arms_industry
			focus = SAF_invest_in_witwatersrand_industry
#			focus = SAF_build_the_kariba_dam
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_complete_recovery"
			custom_effect_tooltip = SWE_tt_decisions_will_be_removed
			set_country_flag = SAF_black_monday_over
			remove_ideas = SAF_black_monday_2
		}
		search_filters = { FOCUS_FILTER_INDUSTRY }
	}
	
	focus = {
		id = SAF_large_scale_roadworks
		icon = GFX_goal_generic_construct_infrastructure
		x = 1
		y = 1
		cost = 5
		relative_position_id = SAF_complete_recovery

		ai_will_do = {
			factor = 100
		}
		

		prerequisite = {
			focus = SAF_complete_recovery
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_large_scale_roadworks"
			random_owned_state = {
				prioritize = {
					545
				}
				add_building_construction = {
					type = infrastructure
					level = 1
					instant_build = yes
				}
			}
			random_owned_state = {
				prioritize = {
					945
				}
				add_building_construction = {
					type = infrastructure
					level = 1
					instant_build = yes
				}
			}
		}
	}
	
	
	focus = {
		id = SAF_sa_arms_industry
		icon = GFX_goal_generic_construct_mil_factory
		x = -1
		y = 1
		cost = 5
		relative_position_id = SAF_complete_recovery

		ai_will_do = {
			factor = 100
		}


		prerequisite = {
			focus = SAF_complete_recovery
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_sa_arms_industry"
			random_owned_state = {
				limit = {
					free_building_slots = {
						building = arms_factory
						size > 1
						include_locked = yes
					}
				}
				prioritize = {
					275 681
				}
				add_building_construction = {
					type = arms_factory
					level = 1
					instant_build = yes
				}
				add_extra_state_shared_building_slots = 1
			}
		}
	}
	
	focus = {
		id = SAF_deal_with_the_protectorates
		icon = GFX_developingtheprotectorates
		x = 6
		y = 0
		cost = 5
		relative_position_id = SAF_black_monday_crisis
		available = {
			has_country_flag = saf_flag_elections_held
		}

		ai_will_do = {
			factor = 100
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_deal_with_the_protectorates"
			add_stability = 0.1
			add_political_power = 50
		}
		search_filters = { FOCUS_FILTER_STABILITY FOCUS_FILTER_POLITICAL }
	}
	
	focus = {
		id = SAF_establish_nuweveld
		icon = GFX_NEE_socialist_pioneer
		x = 4	
		y = 1
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		available = {
			has_authoritarian_government = yes
		}
		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_deal_with_the_protectorates
		}
		mutually_exclusive = {
			focus = SAF_empower_paramount_chiefs
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_establish_nuweveld"
			add_stability = -0.1
			custom_effect_tooltip = SAF_tt_nuweveld_enabled
			hidden_effect = {
				activate_mission = SAF_yearly_nuweveld_report
				country_event = { id = saf.56 }
				set_variable = { SAF_whites_in_botswana = 7028 }
				set_variable = { SAF_tswana_insurgency = 0 }
				set_variable = { SAF_settling_attractiveness = 0.02 }
				country_event = { id = saf.61 days = 100 }
				MAF = { country_event = { id = sharedafrika.121 days = 18 } }
				PAF = { country_event = { id = sharedafrika.121 days = 18 } }
				POR = { country_event = { id = sharedafrika.121 days = 18 } }
				ZIM = { country_event = { id = sharedafrika.121 days = 18 } }
				NMB = { country_event = { id = sharedafrika.121 days = 18 } }
				ZAM = { country_event = { id = sharedafrika.121 days = 18 } }
				BSC = { country_event = { id = sharedafrika.121 days = 18 } }
				MLW = { country_event = { id = sharedafrika.121 days = 18 } }
				KTG = { country_event = { id = sharedafrika.121 days = 18 } }
				if = {
					limit = {
						country_exists = ENT
						ENT = { is_faction_leader = yes }
					}
					ENT = {
						country_event = { id = saf.66 days = 20 }
					}
				}
			}
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}
	
	focus = {
		id = SAF_encourage_farmer_resettlement
		icon = GFX_afrikanersettlementintheprotectorates
		x = 3
		y = 2
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_establish_nuweveld
		}
#		mutually_exclusive = {
#			focus = SAF_bail_out_farmers
#		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_encourage_farmer_resettlement"
			custom_effect_tooltip = SAF_tt_nuweveld_sevenhundred_new_settlers
			add_to_variable = { SAF_whites_in_botswana = 700 }
			hidden_effect = {
				542 = {
					add_manpower = 700
				}
			}
		}
	}
	
	focus = {
		id = SAF_long_term_investment_loans
		icon = GFX_compensatewhitesettlers
		x = 3
		y = 3
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_encourage_farmer_resettlement
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_long_term_investment_loans"
			custom_effect_tooltip = SAF_tt_settlement_attractiveness_increased_5
			add_to_variable = { SAF_settling_attractiveness = 0.05 }
		}
	}
	
	focus = {
		id = SAF_build_the_kariba_dam
		icon = GFX_thekaribadam
		x = 3
		y = 4
		cost = 5
		relative_position_id = SAF_black_monday_crisis
		available = {
			has_full_control_of_state = 947
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_long_term_investment_loans
		}
		prerequisite = {
			focus = SAF_new_towns_and_villages
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_build_the_kariba_dam"
			custom_effect_tooltip = SAF_tt_kariba_dam_prepared
			947 = {
				add_building_construction = {
					type = infrastructure
					level = 1
					instant_build = yes
				}
			}
		}
	}
	
	focus = {
		id = SAF_annex_the_protectorates
		icon = GFX_expropriatingland
		x = 4
		y = 5
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_build_the_kariba_dam
		}
		prerequisite = {
			focus = SAF_diversified_territorial_economy
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_annex_the_protectorates"
			542 = { # Bechualand
				remove_claim_by = SAF
				add_core_of = SAF
			}
			if = {
				limit = {
					country_exists = BOT
					BOT = {
						is_in_faction = no
						is_subject = no
					}
				}
				declare_war_on = {
					target = BOT
					type = annex_everything
				}
			}
			85 = { # Lesotho
				remove_claim_by = SAF
				add_core_of = SAF
			}
			if = {
				limit = {
					country_exists = LES
					LES = {
						is_in_faction = no
						is_subject = no
					}
				}
				declare_war_on = {
					target = LES
					type = annex_everything
				}
			}
			738 = { # Swaziland
				remove_claim_by = SAF
				add_core_of = SAF
			}
			custom_effect_tooltip = SAF_tt_basutoland_and_swaziland_integrated
		}
		search_filters = { FOCUS_FILTER_POLITICAL FOCUS_FILTER_ANNEXATION }
	}
	
	focus = {
		id = SAF_stellaland_affairs_act
		icon = GFX_goal_white_star
		x = 4
		y = 6
		cost = 5
		relative_position_id = SAF_black_monday_crisis
		available = {
			custom_trigger_tooltip = {
				tooltip = saf_flag_nuweveld_completed		
				check_variable = { SAF_whites_in_botswana > 29999 }
			}
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_annex_the_protectorates
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_stellaland_affairs_act"
			542 = {
				set_state_name = "Stellaland"
				add_core_of = SAF
			}
			add_political_power = 25
			if = {
				limit = {
					has_country_flag = saf_national_turned_pataut
				}
				add_popularity = { ideology = paternal_autocrat popularity = 0.02 }
			}
			else_if = {
				limit = {
					has_completed_focus = SAF_reorganise_the_national_party
				}
				add_popularity = { ideology = national_populist popularity = 0.02 }
			}
			else = {
				add_popularity = { ideology = authoritarian_democrat popularity = 0.02 }
			}
			hidden_effect = { country_event = { id = saf.316 days = 90 random = 30 } }
		}
		search_filters = { FOCUS_FILTER_POLITICAL FOCUS_FILTER_ANNEXATION }
	}
	
	focus = {
		id = SAF_expand_nuweveld_infra
		icon = GFX_hopetownrailport
		x = 5
		y = 2
		cost = 5
		relative_position_id = SAF_black_monday_crisis
		available = {
			has_full_control_of_state = 542
		}
		bypass = {
			NOT = {
				has_full_control_of_state = 542
			}
		}
		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_establish_nuweveld
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_expand_nuweveld_infra"
			542 = {
				add_building_construction = {
					type = infrastructure
					level = 2
					instant_build = yes
				}
			}
			custom_effect_tooltip = SAF_tt_settling_attractiveness_increased_2
			add_to_variable = { SAF_settling_attractiveness = 0.02 }
		}
	}
	
	focus = {
		id = SAF_new_towns_and_villages
		icon = GFX_thenuweveld
		x = 5
		y = 3
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_expand_nuweveld_infra
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_new_towns_and_villages"
			custom_effect_tooltip = SAF_tt_settlement_attractiveness_increased_5
			add_to_variable = { SAF_settling_attractiveness = 0.05 }
		}
	}
	
	focus = {
		id = SAF_diversified_territorial_economy
		icon = GFX_promiseboerautonomy
		x = 5
		y = 4
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_long_term_investment_loans
		}
		prerequisite = {
			focus = SAF_new_towns_and_villages
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_new_towns_and_villages"
			unlock_decision_tooltip = SAF_develop_orange_free_state_steel_mines
			unlock_decision_tooltip = SAF_develop_rhodesia_steel_mines
			if = {
				limit = {
					542 = {
						free_building_slots = {
							building = industrial_complex
							size > 0
							include_locked = yes
						}
					}
				}
				542 = {
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
					add_extra_state_shared_building_slots = 1
				}
			}
		}
	}
	
	focus = {
		id = SAF_empower_paramount_chiefs
		icon = GFX_theparamountchiefs
		x = 8	
		y = 1
		cost = 5
		relative_position_id = SAF_black_monday_crisis
		available = {
			has_elected_government = yes
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_deal_with_the_protectorates
		}
		mutually_exclusive = {
			focus = SAF_establish_nuweveld
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_empower_paramount_chiefs"
			modify_country_flag = { flag = SAF_segregation_reform value = 1 }
			add_political_power = 50
			add_stability = 0.05
			SAF_reform_segregation_1 = yes
		}
		search_filters = { FOCUS_FILTER_POLITICAL FOCUS_FILTER_MANPOWER }
	}
	
	focus = {
		id = SAF_develop_basutoland_swaziland
		icon = GFX_purchasingland
		x = 7	
		y = 2
		cost = 5
		relative_position_id = SAF_black_monday_crisis
		available = {
			has_full_control_of_state = 85
		}
		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_empower_paramount_chiefs
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_develop_basutoland_swaziland"
			random_owned_state = {
				limit = {
					free_building_slots = {
						building = industrial_complex
						size > 0
						include_locked = yes
					}
				}
				prioritize = {
					85
				}
				add_building_construction = {
					type = industrial_complex
					level = 1
					instant_build = yes
				}
				add_extra_state_shared_building_slots = 1
			}
		}
		search_filters = { FOCUS_FILTER_INDUSTRY }
	}
	
	focus = {
		id = SAF_develop_bechuanaland
		icon = GFX_goal_generic_loans
		x = 9	
		y = 2
		cost = 5
		relative_position_id = SAF_black_monday_crisis
		available = {
			has_full_control_of_state = 542
		}
		bypass = {
			NOT = { has_full_control_of_state = 542 }
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_empower_paramount_chiefs
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_develop_bechuanaland"
			if = {
				limit = {
					542 = {
						free_building_slots = {
							building = industrial_complex
							size > 0
							include_locked = yes
						}
					}
				}
				542 = {
					add_building_construction = {
						type = industrial_complex
						level = 1
						instant_build = yes
					}
					add_extra_state_shared_building_slots = 1
				}
			}
		}
		search_filters = { FOCUS_FILTER_INDUSTRY }
	}
	
	focus = {
		id = SAF_root_out_slavery
		icon = GFX_hintatmorenativerights
		x = 8	
		y = 3
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_develop_bechuanaland
		}
		prerequisite = {
			focus = SAF_develop_basutoland_swaziland
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_root_out_slavery"
			add_political_power = 100
			remove_ideas = SAF_idea_slavery
		}
		search_filters = { FOCUS_FILTER_STABILITY }
	}
	
	focus = {
		id = SAF_question_of_native_autonomy
		icon = GFX_extendingnativeautonomy
		x = 8	
		y = 4
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_root_out_slavery
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_question_of_native_autonomy"
			country_event = { id = saf.11 }
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}
	
	focus = {
		id = SAF_strengthen_advisory_councils
		icon = GFX_SAF_race_council
		x = 7	
		y = 5
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_question_of_native_autonomy
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_strengthen_advisory_councils"
			add_political_power = 25
			add_ideas = SAF_idea_native_advisory_councils
		}
		search_filters = { FOCUS_FILTER_POLITICAL FOCUS_FILTER_STABILITY FOCUS_FILTER_RESISTANCE }
	}
	
	focus = {
		id = SAF_chief_justice_of_the_high_commissioner_territories
		icon = GFX_goal_DOM_The_Trial
		x = 9	
		y = 5
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_question_of_native_autonomy
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_chief_justice_of_the_high_commissioner_territories"
			country_event = { id = saf.26 }
		}
	}
	
	focus = {
		id = SAF_reform_the_commissioner_system
		icon = GFX_decouplethelegislature
		x = 8	
		y = 6
		cost = 5
		relative_position_id = SAF_black_monday_crisis

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_chief_justice_of_the_high_commissioner_territories
		}
		prerequisite = {
			focus = SAF_strengthen_advisory_councils
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_reform_the_commissioner_system"
			ENT = {
				country_event = { id = saf.27 }
			}
			if = {
				limit = {
					owns_state = 85
				}
				add_state_core = 85
			}
			if = {
				limit = {
					owns_state = 738
				}
				add_state_core = 738
			}
			if = {
				limit = {
					owns_state = 542
				}
				add_state_core = 542
			}
		}
		search_filters = { FOCUS_FILTER_POLITICAL FOCUS_FILTER_ANNEXATION }
	}
	
	focus = {
		id = SAF_general_elections
		icon = GFX_goal_SAF_affairs_of_the_union
		x = 14	
		y = 0
		cost = 2
		
		available = {
			date > 1938.01.01
			has_country_flag = saf_flag_elections_held
		}

		ai_will_do = {
			factor = 100
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_general_elections"
			add_political_power = 25
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}
	
	focus = {
		id = SAF_proclaim_the_republic
		icon = GFX_birthofthesuidafrikaanserepubliek
		x = -3
		y = 1
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			has_government = paternal_autocrat
		}
		bypass = {
			has_cosmetic_tag = SAF_republic
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_general_elections
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_proclaim_the_republic"
			country_event = { id = saf.51 }
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}
	
	focus = {
		id = SAF_replace_the_pound
		icon = GFX_focus_mex_privatisation
		x = -2
		y = 2
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			has_authoritarian_government = yes
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_proclaim_the_republic
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_replace_the_pound"
			add_ideas = SAF_idea_sovereign_currency
		}
		search_filters = { FOCUS_FILTER_POLITICAL FOCUS_FILTER_STABILITY }
	}
	
	focus = {
		id = SAF_reorganise_the_national_party
		icon = GFX_slaanterug
		x = -2
		y = 4
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			OR = {
				AND = {
					OR = {
						has_government = authoritarian_democrat
						has_government = paternal_autocrat
					}
					NOT = {
						is_subject = yes
					}
				}
				has_government = national_populist
			}
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_replace_the_pound
		}
		prerequisite = {
			focus = SAF_flags_amendment_act
		}
		mutually_exclusive = {
			focus = SAF_expel_rensburg_pirow
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_reorganise_the_national_party"
			country_event = { id = saf.36 }
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}
	
	focus = {
		id = SAF_implement_apartheid
		icon = GFX_apartheidrealised
		x = -1
		y = 5
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			has_authoritarian_government = yes
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_reorganise_the_national_party
			focus = SAF_expel_rensburg_pirow
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_implement_apartheid"
			if = {
				limit = { has_idea = SAF_segregation_1 }
				remove_ideas = SAF_segregation_1
			}
			if = {
				limit = { has_idea = SAF_segregation_2 }
				remove_ideas = SAF_segregation_2
			}
			if = {
				limit = { has_idea = SAF_segregation_3 }
				remove_ideas = SAF_segregation_3
			}
			if = {
				limit = { has_idea = SAF_segregation_4 }
				remove_ideas = SAF_segregation_4
			}
			if = {
				limit = { has_idea = SAF_segregation_5 }
				remove_ideas = SAF_segregation_5
			}
			country_event = saf.29
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}
	
	focus = {
		id = SAF_independent_perspective
		icon = GFX_go_our_own_way
		x = -3
		y = 6
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			has_authoritarian_government = yes
			NOT = {
				has_idea = SAF_wavering_dominion
				has_idea = SAF_neutral_dominion
			}
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_implement_apartheid
		}
		mutually_exclusive = {
			focus = SAF_retreat_from_european_affairs
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_independent_perspective"
			custom_effect_tooltip = SAF_tt_get_decisions_to_join_faction
		}
	}
	
	focus = {
		id = SAF_retreat_from_european_affairs
		icon = GFX_splendid_isolation_in_africa
		x = -1
		y = 6
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			has_authoritarian_government = yes
		}

		ai_will_do = {
			factor = 0
			modifier = {
				factor = 0.5
				has_government = paternal_autocrat
			}
			modifier = {
				factor = 0.1
				has_government = national_populist
			}
		}
		prerequisite = {
			focus = SAF_implement_apartheid
		}
		mutually_exclusive = {
			focus = SAF_independent_perspective
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_retreat_from_european_affairs"
			add_political_power = 100
			add_stability = 0.05
		}
	}
	
	focus = {
		id = SAF_native_representation_act
		icon = GFX_representationofthenativesact
		x = -1
		y = 1
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			OR = {
				has_government = authoritarian_democrat
				has_government = paternal_autocrat
			}
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_general_elections
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_native_representation_act"
			country_event = { id = saf.37 }
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}
	
	focus = {
		id = SAF_gerrymander_districts
		icon = GFX_patchingupthecracks
		x = 0
		y = 2
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			has_authoritarian_government = yes
			NOT = {
				has_country_flag = SAF_fusion
			}
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_native_representation_act
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_gerrymander_districts"
			add_political_power = 100
			custom_effect_tooltip = saf_tt_gerrymandered
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}
	
	focus = {
		id = SAF_flags_amendment_act
		icon = GFX_focus_eng_decolonization
		x = -1
		y = 3
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			has_authoritarian_government = yes
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_gerrymander_districts
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_flags_amendment_act"
			add_stability = 0.1
		}
		search_filters = { FOCUS_FILTER_STABILITY }
	}
	
	focus = {
		id = SAF_expel_rensburg_pirow
		icon = GFX_nasionalebaasskap
		x = 0
		y = 4
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			OR = {
				has_government = authoritarian_democrat
				has_government = paternal_autocrat
			}
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_flags_amendment_act
		}
		mutually_exclusive = {
			focus = SAF_reorganise_the_national_party
		}	

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_expel_rensburg_pirow"
			country_event = {  id = saf.38 }
		}
	}
	
	focus = {
		id = SAF_coloured_enfranchisement_act
		icon = GFX_expandallotedrepresentatives
		x = 1
		y = 1
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			OR = {
				AND = {
					has_government = social_conservative
					NOT = {
						has_country_flag = SAF_national_conservative_party_formed
					}
				}
				has_government = social_liberal
			}
			NOT = {
				has_country_flag = saf_flag_cea_failed
			}
		}
		
		select_effect = {
			country_event = { id = saf.45 }
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_general_elections
		}	

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_coloured_enfranchisement_act"
			custom_effect_tooltip = SAF_tt_warning_stuck_up_conservatives
			country_event = { id = saf.48 }
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}
	
	focus = {
		id = SAF_native_trust_and_land_act
		icon = GFX_nativetrustandlandact
		x = 1
		y = 3
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			OR = {
				has_government = social_liberal
				has_government = social_conservative
				AND = {
					has_government = authoritarian_democrat
					has_country_flag = SAF_fusion
				}
			}
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_coloured_enfranchisement_act
			focus = SAF_native_representation_act
		}	

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_native_trust_and_land_act"
			country_event = { id = saf.39 }
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}
	
	focus = {
		id = SAF_asiatic_land_tenure_act
		icon = GFX_enactlimitedlandreform
		x = 2
		y = 2
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			has_government = social_conservative
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_general_elections
		}	

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_asiatic_land_tenure_act"
			country_event = { id = saf.40 }
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}
	
	focus = {
		id = SAF_natives_consolidation_act
		icon = GFX_nationwidecolourbar
		x = 3
		y = 3
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			has_government = social_conservative
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_asiatic_land_tenure_act
		}	

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_natives_consolidation_act"
			modify_country_flag = { flag = SAF_segregation_reform value = -1 }
			add_political_power = 50
			SAF_increase_segregation_1 = yes
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}
	
	focus = {
		id = SAF_vaalhart_irrigation_scheme
		icon = GFX_goal_SZC_dujiangyan_irrigation_system
		x = 2
		y = 4
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			has_full_control_of_state = 945
			has_full_control_of_state = 947
			#945 = {
			#	free_building_slots = {
			#		building = industrial_complex
			#		size > 1
			#		include_locked = yes
			#	}
			#}
			#947 = {
			#	free_building_slots = {
			#		building = industrial_complex
			#		size > 0
			#		include_locked = yes
			#	}
			#}
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_native_trust_and_land_act
			focus = SAF_natives_consolidation_act
		}	

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_vaalhart_irrigation_scheme"
			945 = {
				add_extra_state_shared_building_slots = 2
			}
			947 = {
				add_extra_state_shared_building_slots = 1
			}
		}
		search_filters = { FOCUS_FILTER_INDUSTRY }
	}
	
	focus = {
		id = SAF_expand_krugerpark
		icon = GFX_goal_SAF_kruger_park
		x = 1
		y = 5
		cost = 5
		relative_position_id = SAF_general_elections

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_vaalhart_irrigation_scheme
		}	

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_expand_krugerpark"
			add_ideas = SAF_idea_krugerpark
		}
	}
	
	focus = {
		id = SAF_enact_smuts_doctrine
		icon = GFX_preparethenortherncampaign
		x = 1
		y = 6
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			OR = {
				has_government = social_conservative
				has_government = social_liberal
			}
			OR = {
				has_war_with = MAF
				has_war_with = GEX
				has_global_flag = MAF_collapse
			}
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_expand_krugerpark
		}
		prerequisite = {
			focus = SAF_fire_broeders
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_enact_smuts_doctrine"
			if = {
				limit = {
					has_global_flag = MAF_collapse
				}
				custom_effect_tooltip = SAF_tt_decisions_to_retake_british_africa
			}
			else = {
				every_state = {
					limit = {
						OR = {
							state = 541 #South West Africa
							state = 547 #Kenya
							state = 548 #Uganda
							state = 813 #South Zambezia
							state = 871 #Nyasaland
							state = 892 #Jubaland
							state = 905 #Zanzibar
							state = 925 #Gallaland
							state = 955 #Eastern Zambezia
							state = 956 #Northern Zambezia
							state = 957 #Western Barotseland
							state = 958 #Eastern Barotseland
							state = 964 #Amboland
							state = 969 #Rift Valley
							state = 970 #Mombasa
						}
					}
					add_claim_by = SAF
					if = {
						limit = {
							NOT = {
								state = 541 #South West Africa
								state = 964 #Amboland
							}
						}
						set_state_flag = SAF_the_empire_strikes_back
						add_to_array = { SAF.potential_colonies_to_return = THIS }
					}
				}
			}
		}
		search_filters = { FOCUS_FILTER_ANNEXATION }
	}
	
	focus = {
		id = SAF_fire_broeders
		icon = GFX_goal_MEX_fire_anticatholic_judges
		x = 3
		y = 5
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			OR = {
				has_government = social_conservative
				has_government = social_liberal
			}
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_vaalhart_irrigation_scheme
		}	

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_fire_broeders"
			add_stability = 0.1
		}
		search_filters = { FOCUS_FILTER_POLITICAL FOCUS_FILTER_STABILITY }
	}
	
	focus = {
		id = SAF_asiatic_enfranchisement_act
		icon = GFX_goal_SAF_reform_voting_law
		x = 3
		y = 6
		cost = 5
		relative_position_id = SAF_general_elections
		available = {
			has_government = social_liberal
			has_completed_focus = SAF_coloured_enfranchisement_act
		}

		ai_will_do = {
			factor = 100
		}
		prerequisite = {
			focus = SAF_expand_krugerpark
		}
		prerequisite = {
			focus = SAF_fire_broeders
		}

		completion_reward = {
			log = "[GetDateText]: [Root.GetName]: Focus SAF_asiatic_enfranchisement_act"
			country_event = { id = saf.44 }
		}
		search_filters = { FOCUS_FILTER_POLITICAL }
	}
	
	shared_focus = SAF_found_sabc
	shared_focus = SAF_New_Rifles
	shared_focus = SAF_Expand_Branches
}