﻿add_namespace = Angola
add_namespace = AngolaNews

### Angola civil war cleanup events ###

#Give the winner AGL cosmetic tag
country_event = {
	id = Angola.0
	
	hidden = yes
	
	trigger = {
		has_start_date < 1.1.2017
		OR = {
			AND = {
				tag = AGL
				NOT = {
					country_exists = UNI
				}
			}
			AND = {
				tag = UNI
				NOT = {
					country_exists = AGL
				}
			}
		}
		NOT = { has_global_flag = Angola_Civil_War_Over }
	}
	
	mean_time_to_happen = {
		days = 2
	}
	
	immediate = {
		#Civil war is over
		set_global_flag = Angola_Civil_War_Over
		#Clear core status
		296 = {
			remove_core_of = AGL
			remove_core_of = UNI
		}
		297 = {
			remove_core_of = AGL
			remove_core_of = UNI
		}
		298 = {
			remove_core_of = AGL
			remove_core_of = UNI
		}
		299 = {
			remove_core_of = AGL
			remove_core_of = UNI
		}
		300 = {
			remove_core_of = AGL
			remove_core_of = UNI
		}
		301 = {
			remove_core_of = AGL
			remove_core_of = UNI
		}
		#Make the winner Angola
		if = {
			limit = {
				tag = UNI
			}
			set_cosmetic_tag = AGL
		}
		add_state_core = 296
		add_state_core = 297
		add_state_core = 298
		add_state_core = 299
		add_state_core = 300
		add_state_core = 301
		set_capital = 298
	}
	
	option = {
		name = Angola.0.a
		hidden_effect = { news_event = { id = AngolaNews.1 hours = 6 } }
		log = "[GetDateText]: [This.GetName]: Angola.0.a executed"
	}
}

#Recreate Angola in case it has been annexed
country_event = {
	id = Angola.1
	
	hidden = yes
	
	trigger = {
		NOT = {
			country_exists = AGL
			country_exists = UNI
		}
		NOT = { 414 = { is_core_of = AGL } }
	}
	
	mean_time_to_happen = {
		days = 2
	}
	
	immediate = {
		#Clear core status
		296 = {
			remove_core_of = AGL
			remove_core_of = UNI
		}
		297 = {
			remove_core_of = AGL
			remove_core_of = UNI
		}
		298 = {
			remove_core_of = AGL
			remove_core_of = UNI
		}
		299 = {
			remove_core_of = AGL
			remove_core_of = UNI
		}
		300 = {
			remove_core_of = AGL
			remove_core_of = UNI
		}
		301 = {
			remove_core_of = AGL
			remove_core_of = UNI
		}
		AFG = {
			add_state_core = 296
			add_state_core = 297
			add_state_core = 298
			add_state_core = 299
			add_state_core = 300
			add_state_core = 301
			set_capital = 298
		}
	}
	
	option = {
		name = Angola.1.a
		log = "[GetDateText]: [This.GetName]: Angola.1.a executed"
	}
}

news_event = {

	id = AngolaNews.1
	title = AngolaNews.1.t
	desc = {
		text = AngolaNews.1.AGL.d
		trigger = { FROM = { original_tag = AGL } }
	}
	desc = {
		text = AngolaNews.1.UNI.d
		trigger = { FROM = { original_tag = UNI } }
	}
	picture = GFX_news_angolan_civil_war
	
	major = yes
	
	is_triggered_only = yes
	
	option = {
		name = AngolaNews.1.a
		log = "[GetDateText]: [This.GetName]: AngolaNews.1.a executed"
	}
	
}