###########################
# Africa Shared Events
###########################

add_namespace = africa_shared

### FROM asks for economic aid
country_event = {
	id = africa_shared.1
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.1" }
	title = africa_shared.1.t
	desc = africa_shared.1.d
	picture = GFX_report_event_soldiers_marching

	is_triggered_only = yes

	option = { #Granted
		name = africa_shared.1.a

		ai_chance = {
			factor = 100
		}
		FROM = {
			country_event = {
				id = africa_shared.2
				days = 5
			}
		}
	}

	option = { #Denied
		name = africa_shared.1.b

		ai_chance = {
			factor = 0
		}

		FROM = {
			country_event = {
				id = africa_shared.3
				days = 5
			}
		}
	}
}

country_event = { #Granted
	id = africa_shared.2
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.2" }
	title = africa_shared.2.t
	desc = africa_shared.2.d
	picture = GFX_report_event_soldiers_marching
	
	is_triggered_only = yes

	option = { #:(
		name = africa_shared.2.a	
		add_stability = 0.02
		swap_ideas = {
			remove_idea = AFR_banks
			add_idea = AFR_banks2
		}
	}

}

country_event = { #Denied
	id = africa_shared.3
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.3" }
	title = africa_shared.3.t
	desc = africa_shared.3.d
	picture = GFX_report_event_soldiers_marching

	is_triggered_only = yes

	option = { #:(
		name = africa_shared.3.a	
		add_stability = -0.02
	}

}

country_event = { #Corruption 
	id = africa_shared.4
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.4" }
	title = africa_shared.4.t
	desc = africa_shared.4.d
	picture = GFX_report_event_soldiers_marching

	is_triggered_only = yes

	option = { #:(
		name = africa_shared.4.a	
		add_ideas = AFR_corruption_5
		add_political_power = -30
		set_country_flag = AFR_fuck_corruption
	}

	option = { #:)
		name = africa_shared.4.b
		add_ideas = AFR_corruption_1
		add_political_power = -30
		set_country_flag = AFR_I_FUCKING_LOVE_CORRUPTION
	}

}

country_event = { #Flow of Rivers
	id = africa_shared.10
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.10" }
	title = africa_shared.10.t
	desc = africa_shared.10.d
	picture = GFX_report_event_GAB_schomburgk 
	
	is_triggered_only = yes
	
trigger = {
		is_ai = no
		NOT = { has_global_flag = MAF_collapse }
	}
	
	fire_only_once = yes

	option = { #
		name = africa_shared.10.a
		add_equipment_to_stockpile = {
			type = support_equipment_1
			amount = 4
			producer = MAF
		}
	}

	option = { #
		name = africa_shared.10.b
		add_political_power = 60
		random_list = {
			50 = {
				country_event = {
					id = africa_shared.11
					days = 12 random_days = 5
				}
			}
			50 = {
				country_event = {
					id = africa_shared.12
					days = 12 random_days = 5
				}
			}
		}
	}
}

country_event = { #Expeditionary Woes
	id = africa_shared.11
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.11" }
	title = africa_shared.11.t
	desc = africa_shared.11.d
	picture = GFX_report_event_GAB_expedition

	is_triggered_only = yes

	option = { #
		name = africa_shared.10.a
		add_war_support = -0.01
	}
}

country_event = { #Trail of Mokélé-mbembé
	id = africa_shared.12
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.12" }
	title = africa_shared.12.t
	desc = africa_shared.12.d
	picture = GFX_report_event_GAB_sketch

	is_triggered_only = yes

	option = { #
		name = africa_shared.12.a
		add_manpower = 20
		random_list = {
			60 = {
				country_event = {
					id = africa_shared.13
					days = 6 random_days = 5
				}
			}
			40 = {
				country_event = {
					id = africa_shared.14
					days = 6 random_days = 5
				}
			}
		}	
	}
}

country_event = { #Disappointment of Modern Science
	id = africa_shared.13
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.13" }
	title = africa_shared.13.t
	desc = africa_shared.13.d
	picture = GFX_report_event_GAB_lake_bangweulu

	is_triggered_only = yes

	option = { #
		name = africa_shared.13.a
		add_political_power = -40	
	}
}

country_event = { #Nature’s Mysteries
	id = africa_shared.14
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.14" }
	title = africa_shared.14.t
	desc = africa_shared.14.d
	picture = GFX_report_event_GAB_mokele_mbembe

	is_triggered_only = yes

	option = { #
		name = africa_shared.14.a
		add_stability = 0.02
		add_ideas = AFR_Mokele_Mbembe
	}
}

country_event = { #Peacing out Portugal
	id = africa_shared.15
	immediate = { log = "[GetDateText]: [Root.GetName]: event shared.15" }
	title = africa_shared.15.t
	desc = africa_shared.15.d
	picture = GFX_report_event_peaceout

	mean_time_to_happen = {
		days = 60
	}
	
	trigger = {
		OR = {
			is_in_africa = yes
			tag = BBR
			tag = NYC
			tag = HAI
		}
		NOT = {
			tag = MAF
			tag = ZAM
		}
		OR = {
			has_war_with = POR
			has_war_with = PAF
		}
		NOT = {
			is_in_faction_with = ENT
			is_in_faction_with = NFA
			is_in_faction_with = INT
			is_in_faction_with = GER
		}
		is_subject = no
		OR = {
			914 = { is_owned_by = POR }
			914 = { is_owned_by = PAF }
		}
		OR = {
			916 = { is_owned_by = POR }
			916 = { is_owned_by = PAF }
		}
		OR = {
			540 = { is_owned_by = POR }
			540 = { is_owned_by = PAF }
		}
		OR = {
			917 = { is_owned_by = POR }
			917 = { is_owned_by = PAF }
		}
		OR = {
			959 = { is_owned_by = POR }
			959 = { is_owned_by = PAF }
		}
		OR = {
			544 = { is_owned_by = POR }
			544 = { is_owned_by = PAF }
		}
		OR = {
			954 = { is_owned_by = POR }
			954 = { is_owned_by = PAF }
		}
		OR = {
			950 = { is_owned_by = POR }
			950 = { is_owned_by = PAF }
		}
		controls_state = 914
		controls_state = 916
		controls_state = 540
		controls_state = 917
		controls_state = 959
		controls_state = 544
		controls_state = 954
		controls_state = 950
	}

	fire_only_once = yes

	option = { #peace out
		name = africa_shared.15.a
		transfer_state = 914
		transfer_state = 916
		transfer_state = 540
		transfer_state = 917
		transfer_state = 959
		transfer_state = 544
		transfer_state = 954
		transfer_state = 950
		if = {
			limit = {
				controls_state = 296
			}
			transfer_state = 296
		}
		hidden_effect = {
			if = {
				limit = {
					POR = { is_in_faction_with = CAN }
				}
				every_enemy_country = {
					limit = {
						is_in_faction_with = CAN
					}
					white_peace_with_ROOT = yes
				}
			}
			else = {
				ROOT = {
					white_peace = POR
				}
				ROOT = {
					white_peace = PAF
				}
			}
		}
	}
	option = {
		name = africa_shared.15.b
		add_war_support = 0.1
	}
}

country_event = { #Peacing out Portugal 2 - Guinea Bissau
	id = africa_shared.16
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.15" }
	title = africa_shared.15.t
	desc = africa_shared.15.d
	picture = GFX_report_event_peaceout

	mean_time_to_happen = {
		days = 60
	}
	
	trigger = {
		OR = {
			is_in_africa = yes
			tag = BBR
			tag = NYC
			tag = HAI
		}
		OR = {
			has_war_with = POR
			has_war_with = PAF
		}
		NOT = {
			is_in_faction_with = ENT
			is_in_faction_with = NFA
			is_in_faction_with = INT
			is_in_faction_with = GER
		}
		is_subject = no
		OR = {
			296 = { is_owned_by = POR }
			296 = { is_owned_by = PAF }
		}
		controls_state = 296
	}

	fire_only_once = yes

	option = { #peace out
		name = africa_shared.15.a
		transfer_state = 296
			if = {
				limit = {
					controls_state = 914
					controls_state = 916
					controls_state = 540
					controls_state = 917
					controls_state = 959
					controls_state = 544
					controls_state = 954
					controls_state = 950
				}
				transfer_state = 914
				transfer_state = 916
				transfer_state = 540
				transfer_state = 917
				transfer_state = 959
				transfer_state = 544
				transfer_state = 954
				transfer_state = 950
			}
		hidden_effect = {
			if = {
				limit = {
					POR = { is_in_faction_with = CAN }
				}
				every_enemy_country = {
					limit = {
						is_in_faction_with = CAN
					}
					white_peace_with_ROOT = yes
				}
			}
			else = {
				ROOT = {
					white_peace = POR
				}
				ROOT = {
					white_peace = PAF
				}
			}
		}
	}
	option = {
		name = africa_shared.15.b
		add_war_support = 0.1
	}
}

country_event = { #Peacing out Spain
	id = africa_shared.17
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.17" }
	title = africa_shared.17.t
	desc = africa_shared.17.d
	picture = GFX_report_event_peaceout

	trigger = {
		OR = {
			is_in_africa = yes
			AND = {
				tag = BBR
				OR = {
					has_completed_focus = BBR_pan_afrikan_identity
					has_completed_focus = BBR_fund_rebels
				}
			}
			AND = {
				tag = NYC
				has_completed_focus = NYC_unchained_black_man
			}
			AND = {
				tag = HAI
				OR = {
					has_completed_focus = HAI_pan_african_plans
					has_completed_focus = HAI_old_world
				}
			}
		}
		NOT = { tag = NFA }
		AND = {
			OR = {
				has_war_with = SPR
				has_war_with = CNT
				has_war_with = CAR
				has_war_with = SFA
			}
		}
		NOT = {
			is_in_faction_with = ENT
			is_in_faction_with = NFA
			is_in_faction_with = INT
			is_in_faction_with = GER
		}
		is_subject = no
		297 = {
			OR = {
				is_owned_by = SPR
				is_owned_by = CNT
				is_owned_by = CAR
				is_owned_by = SFA
			}
		}
		1335 = {
			OR = {
				is_owned_by = SPR
				is_owned_by = CNT
				is_owned_by = CAR
				is_owned_by = SFA
			}
		}
		controls_state = 297
		controls_state = 1335
	}

	fire_only_once = yes

	option = { #peace out
		name = africa_shared.17.a
		transfer_state = 297
		transfer_state = 1335
		if = { 
			limit = {
				controls_state = 1318
				controls_state = 699
				controls_state = 290
			}
			transfer_state = 1318
			transfer_state = 699
			transfer_state = 290
		}
		hidden_effect = {
			if = {
				limit = {
					OR = {
						CAR = { is_in_faction_with = CAN }
						CNT = { is_in_faction_with = FRA }
						SPR = {
							is_in_faction_with = CAN
							is_in_faction_with = GER
						}
						SFA = {
							is_in_faction_with = CAN
							is_in_faction_with = GER
						}
					}
				}
				every_enemy_country = {
					limit = {
						is_in_faction_with = CAN
						is_in_faction_with = GER
						is_in_faction_with = FRA
					}
					white_peace_with_ROOT = yes
				}
			}
			else = {
				ROOT = {
					white_peace = CAR
					white_peace = CNT
					white_peace = SPR
					white_peace = SFA
				}
			}
		}
	}
	option = {
		name = africa_shared.17.b
		add_war_support = 0.1
	}
}

country_event = { #Peacing out Spain 2
	id = africa_shared.18
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.17" }
	title = africa_shared.17.t
	desc = africa_shared.17.d
	picture = GFX_report_event_peaceout

	trigger = {
		OR = {
			is_in_africa = yes
			AND = {
				tag = BBR
				OR = {
					has_completed_focus = BBR_pan_afrikan_identity
					has_completed_focus = BBR_fund_rebels
				}
			}
			AND = {
				tag = NYC
				has_completed_focus = NYC_unchained_black_man
			}
			AND = {
				tag = HAI
				OR = {
					has_completed_focus = HAI_pan_african_plans
					has_completed_focus = HAI_old_world
				}
			}
		}
		NOT = { tag = NFA }
		AND = {
			OR = {
				has_war_with = SPR
				has_war_with = CNT
				has_war_with = CAR
				has_war_with = SFA
			}
		}
		NOT = {
			is_in_faction_with = ENT
			is_in_faction_with = NFA
			is_in_faction_with = INT
			is_in_faction_with = GER
		}
		is_subject = no
		1318 = {
			OR = {
				is_owned_by = SPR
				is_owned_by = CNT
				is_owned_by = CAR
				is_owned_by = SFA
			}
		}
		699 = {
			OR = {
				is_owned_by = SPR
				is_owned_by = CNT
				is_owned_by = CAR
				is_owned_by = SFA
			}
		}
		290 = {
			OR = {
				is_owned_by = SPR
				is_owned_by = CNT
				is_owned_by = CAR
				is_owned_by = SFA
			}
		}
		controls_state = 1318
		controls_state = 699
		controls_state = 290
	}

	fire_only_once = yes

	option = { #peace out
		name = africa_shared.17.a
		transfer_state = 1318
		transfer_state = 699
		transfer_state = 290
		if = {
			limit = {
				controls_state = 297
			}
			transfer_state = 297
		}
		if = {
			limit = {
				controls_state = 1335
			}
			transfer_state = 1335
		}
		hidden_effect = {
			if = {
				limit = {
					OR = {
						CAR = { is_in_faction_with = CAN }
						CNT = { is_in_faction_with = FRA }
						SPR = {
							is_in_faction_with = CAN
							is_in_faction_with = GER
						}
						SFA = {
							is_in_faction_with = CAN
							is_in_faction_with = GER
						}
					}
				}
				every_enemy_country = {
					limit = {
						is_in_faction_with = CAN
						is_in_faction_with = GER
						is_in_faction_with = FRA
					}
					white_peace_with_ROOT = yes
				}
			}
			else = {
				ROOT = {
					white_peace = CAR
					white_peace = CNT
					white_peace = SPR
					white_peace = SFA
				}
			}
		}
	}
	option = {
		name = africa_shared.17.b
		add_war_support = 0.1
	}
}

country_event = { #Peacing out South Africa
	id = africa_shared.19
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.19" }
	title = africa_shared.19.t
	desc = africa_shared.19.d
	picture = GFX_report_event_peaceout

	mean_time_to_happen = {
		days = 60
	}

trigger = {
		OR = {
			is_in_africa = yes
			tag = BBR
			tag = NYC
			tag = HAI
		}
		NOT = { tag = SAF }
		AND = {
			SAF = {
				OR = {
					is_in_faction_with = ENT
					is_in_faction_with = GER
					is_in_faction_with = FRA
				}
			}
		}
		has_war_with = SAF
		is_subject = no
		controls_state = 275
		controls_state = 719
		controls_state = 947
		controls_state = 945
		controls_state = 542
		controls_state = 681
		controls_state = 946
		controls_state = 1176
	}

	fire_only_once = yes

	option = { #peace out
		name = africa_shared.19.a
		ai_chance = {
			factor = 0
		}
		hidden_effect = {
			annex_country = {
					target = SAF
				}
			every_enemy_country = {
				limit = {
					OR = {
						is_in_faction_with = ENT
						is_in_faction_with = GER
						is_in_faction_with = FRA
					}	
				}
				white_peace_with_ROOT = yes
			}
		}
	}
	option = {
		name = africa_shared.19.b
		ai_chance = {
			factor = 100
		}
		add_war_support = 0.1
	}
}

country_event = { #Peacing out Westafrika
	id = africa_shared.20
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.20" }
	title = africa_shared.20.t
	desc = africa_shared.20.d
	picture = GFX_report_event_peaceout

	mean_time_to_happen = {
		days = 60
	}

trigger = {
		OR = {
			is_in_africa = yes
			tag = BBR
			tag = NYC
			tag = HAI
		}
		AND = { has_war_with = ENT }
		CIV = { is_in_faction_with = ENT }
		is_subject = no
		controls_state = 807
		controls_state = 963
		controls_state = 274
		controls_state = 1321
		controls_state = 1322
		controls_state = 1323
		controls_state = 877
		controls_state = 876
	}

	fire_only_once = yes

	option = { #peace out
		name = africa_shared.19.a
		ai_chance = {
			factor = 0
		}
		annex_country = {
			target = CIV
		}
		hidden_effect = {
			every_enemy_country = {
				limit = {
					is_in_faction_with = ENT
				}
				white_peace_with_ROOT = yes
			}
		}
	}
	option = {
		name = africa_shared.19.b
		ai_chance = {
			factor = 100
		}
		add_war_support = 0.1
	}
}

country_event = { #Peacing for Togo
	id = africa_shared.21
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.21" }
	title = africa_shared.21.t
	desc = africa_shared.21.d
	picture = GFX_report_event_peaceout

	mean_time_to_happen = {
		days = 60
	}

trigger = {
		OR = {
			is_in_africa = yes
			tag = BBR
			tag = NYC
			tag = HAI
		}
		AND = { has_war_with = ENT}
		TOG = { is_in_faction_with = ENT }
		is_subject = no
		controls_state = 807
		controls_state = 963
		controls_state = 274
		controls_state = 1321
		controls_state = 1322
		controls_state = 1323
		controls_state = 877
		controls_state = 876
	}

	fire_only_once = yes

	option = { #peace out
		name = africa_shared.19.a
		ai_chance = {
			factor = 0
		}
		annex_country = {
			target = TOG
		}
		hidden_effect = {
			every_enemy_country = {
				limit = {
					is_in_faction_with = ENT
				}
				white_peace_with_ROOT = yes
			}
		}
	}
	option = {
		name = africa_shared.19.b
		ai_chance = {
			factor = 100
		}
		add_war_support = 0.1
	}
}

country_event = { #Peacing for Morocco
	id = africa_shared.22
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.22" }
	title = africa_shared.22.t
	desc = africa_shared.22.d
	picture = GFX_report_event_peaceout

	mean_time_to_happen = {
		days = 60
	}

trigger = {
		OR = {
			is_in_africa = yes
			tag = BBR
			tag = NYC
			tag = HAI	
		}
		AND = { has_war_with = GER }
		MOR = { is_in_faction_with = GER }
		is_subject = no
		controls_state = 461
		controls_state = 462
	}

	fire_only_once = yes

	option = { #peace out
		name = africa_shared.19.a
		ai_chance = {
			factor = 0
		}
		hidden_effect = {
			annex_country = {
				target = MOR
			}
			every_enemy_country = {
				limit = {
					is_in_faction_with = GER
				}
				white_peace_with_ROOT = yes
			}
		}
	}
	option = {
		name = africa_shared.19.b
		ai_chance = {
			factor = 100
		}
		add_war_support = 0.1
	}
}

country_event = { #Peacing for Gabon
	id = africa_shared.23
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.23" }
	title = africa_shared.23.t
	desc = africa_shared.23.d
	picture = GFX_report_event_peaceout

	mean_time_to_happen = {
		days = 60
	}

trigger = {
		OR = {
			is_in_africa = yes
			tag = BBR
			tag = NYC
			tag = HAI
		}
		AND = { has_war_with = ENT }
		GAB = { is_in_faction_with = ENT }
		is_subject = no
		controls_state = 539
	}

	fire_only_once = yes

	option = { #peace out
		name = africa_shared.19.a
		ai_chance = {
			factor = 0
		}
		annex_country = {
			target = GAB
		}
		hidden_effect = {
			every_enemy_country = {
				limit = {
					is_in_faction_with = ENT
				}
				white_peace_with_ROOT = yes
			}
		}
	}
	option = {
		name = africa_shared.19.b
		ai_chance = {
			factor = 100
		}
		add_war_support = 0.1
	}
}

country_event = { #Peacing for Dahomey
	id = africa_shared.24
	immediate = { log = "[GetDateText]: [Root.GetName]: event africa_shared.24" }
	title = africa_shared.24.t
	desc = africa_shared.24.d
	picture = GFX_report_event_peaceout

	mean_time_to_happen = {
		days = 60
	}

trigger = {
		OR = {
			is_in_africa = yes
			tag = BBR
			tag = NYC
			tag = HAI
		}
		AND = { has_war_with = ENT }
		DAH = { is_in_faction_with = ENT }
		is_subject = no
		controls_state = 876
	}

	fire_only_once = yes

	option = { #peace out
		name = africa_shared.19.a
		ai_chance = {
			factor = 0
		}
		annex_country = {
			target = DAH
		}
		hidden_effect = {
			every_enemy_country = {
				limit = {
					is_in_faction_with = ENT
				}
				white_peace_with_ROOT = yes
			}
		}
	}
	option = {
		name = africa_shared.19.b
		ai_chance = {
			factor = 100
		}
		add_war_support = 0.1
	}
}