add_namespace = political

# Country has same ideology as revolter
country_event = {
	id = political.28
	title = political.28.t
	desc = political.28.d

	picture = GFX_report_event_journalists_speech

	trigger = {
		is_subject = no
		has_civil_war = yes
		NOT = { has_country_flag = ENG_communist_civil_war }
		NOT = {
			AND = {
				has_dlc = "La Resistance"
				original_tag = SPR
				SPR_scw_in_progress = yes
			}
			AND = {
				has_dlc = "La Resistance"
				original_tag = POR
				has_global_flag = SPR_portuguese_anarchism_flag
			}
			AND = {
				has_dlc = "Battle for the Bosporus"
				original_tag = BUL
				OR = {
					has_country_flag = BUL_zveno_coup_flag
					has_country_flag = BUL_zveno_bulgaria_flag
				}
			}
			AND = {
				has_dlc = "No Step Back"
				OR = {
					original_tag = POL
					original_tag = EST
					original_tag = LAT
					original_tag = LIT
					original_tag = ROM
					AND = {
						original_tag = FIN
						EST = { has_completed_focus = EST_national_pride_in_finland }
					}
					original_tag = BLR #Baltic Belarus civil war
				}
			}
			AND = {
				original_tag = SOV
				has_global_flag = SOV_soviet_civil_war # Stalin doesn't really want to reconciliate with Trotsky/Bukharin at this point
			}
			AND = {
				has_dlc = "Battle for the Bosporus"
				original_tag = TUR
			}
			AND = {
				has_dlc = "By Blood Alone"
				original_tag = ETH
				has_country_flag = ETH_communist_civil_war
			}
			AND = {
				has_dlc = "Graveyard of Empires"
				original_tag = AFG
				has_country_flag = AFG_mughal_civil_war
			}
		}
		any_other_country = {
			NOT = { tag = ROOT }
			original_tag = ROOT
			is_subject = no
			has_government = ROOT
			has_war_with = ROOT
		}
	}

	mean_time_to_happen = {
		days = 2
	}

	option = {
		name = political.28.a
		random_other_country = {
			limit = {
				original_tag = ROOT
				NOT = { tag = ROOT }
			}
			ROOT = { annex_country = { target = PREV transfer_troops = yes } }
		}
	}
}
#TODO_TA remove this or the on_action
## Dispatcher event 
#country_event = {
#	id = political.30
#	title = political.30.t
#	desc = political.30.d
#
#	picture = GFX_report_event_journalists_speech
#	hidden = yes 
#	mean_time_to_happen = {
#		days = 3
#	}
#	trigger = {
#		is_subject = no
#		NOT = { has_country_flag = yes_to_unification_flag }
#		NOT = { has_country_flag = no_to_unification_flag }
#		NOT = { has_country_flag = unification_request_sent_flag }
#		any_country_with_original_tag = {
#			original_tag_to_check = ROOT
#			NOT = { tag = ROOT }
#			is_subject = no
#			has_government = ROOT
#			has_war = no
#			NOT = { has_country_flag = yes_to_unification_flag }
#			NOT = { has_country_flag = no_to_unification_flag }
#			NOT = { has_country_flag = unification_request_sent_flag }
#		}
#		
#	}
#	immediate = {
#		LOG = "dispatcher event for [ROOT.GetName] triggered" #TODO_TA Remove logging
#	}
#	option = {
#		name = political.30.a
#		every_country = {
#			limit = {
#				original_tag = ROOT 
#				is_subject = no
#				has_government = ROOT
#				has_war = no
#				NOT = { has_country_flag = yes_to_unification_flag }
#				NOT = { has_country_flag = no_to_unification_flag }
#				NOT = { has_country_flag = unification_request_sent_flag }
#			}
#			set_country_flag = unification_request_sent_flag
#			country_event = {
#				id = political.31
#				hours = 4 
#				random_hours = 16 
#			}
#		}
#	} 
#
#}

# After Peace Conference, suggest unification
country_event = {
	id = political.31
	title = political.31.t
	desc = political.31.desc

	picture = GFX_report_event_journalists_speech
	is_triggered_only = yes 
	trigger = {
		is_subject = no
		NOT = { has_country_flag = yes_to_unification_flag }
		NOT = { has_country_flag = no_to_unification_flag }
		any_country_with_original_tag = {
			original_tag_to_check = ROOT
			NOT = { tag = ROOT }
			is_subject = no
			has_government = ROOT
			has_war = no
		}
	}
	
	immediate = {
		# LOG = "[ROOT.GetLeader]'s [ROOT.GetName] got event" #TODO_TA Remove logging
		IF = {
			limit = {
				has_global_flag = global_unification_request_sent_flag
			}
			clr_global_flag = global_unification_request_sent_flag
		}
	}

	option = {
		name = political.31.a
		set_country_flag = yes_to_unification_flag
		clr_country_flag = unification_request_sent_flag 
	}
	option = {
		name = political.31.b
		ai_chance = {
			base = 0
		}
		set_country_flag = no_to_unification_flag 
		clr_country_flag = unification_request_sent_flag
	}
}

# Unification event
country_event = {
	id = political.32
	title = political.32.t
	desc = political.32.desc

	picture = GFX_report_event_journalists_speech

	trigger = {
		is_subject = no
		has_country_flag = yes_to_unification_flag
		any_other_country = {
			NOT = { tag = ROOT }
			original_tag = ROOT
			has_country_flag = yes_to_unification_flag
			is_subject = no
			has_government = ROOT
			has_war = no
		}
		NOT = {
			any_other_country = {
				original_tag = ROOT
				has_government = ROOT
				has_country_flag = unification_request_sent_flag
			}
		}
	}
	mean_time_to_happen = {
		days = 2
	}
	immediate = {
		# LOG = "[ROOT.GetLeader]'s [ROOT.GetName] to unify countries" #TODO_TA Remove logging

	}

	option = {
		name = political.32.a
		trigger = {
			ROOT = { is_ai = no }
		}
		clr_country_flag = yes_to_unification_flag 
		clr_country_flag = unification_request_sent_flag
		#log = "Player ROOT [ROOT.GetName] to annex"
		every_other_country = {
			limit = {
				original_tag = ROOT
				has_country_flag = yes_to_unification_flag
				is_subject = no
				has_government = ROOT
				has_war = no
			}
			clr_country_flag = yes_to_unification_flag
			ROOT = { annex_country = { target = PREV transfer_troops = yes } }
		}
		news_event = {
			id = news.350
			hours = 8 
			random_hours = 8 
		}
	}
	option = {
		name = political.32.b #Only for AI. No need to localize
		trigger = {
			ROOT = { is_ai = yes }
		}
		IF = {
			limit = {
				any_other_country = {
					NOT = { tag = ROOT }
					original_tag = ROOT
					has_country_flag = yes_to_unification_flag
					is_subject = no
					has_government = ROOT
					has_war = no
					is_ai = no 
				}
			}
			log = "ai ROOT - Human player [ROOT.GetName] to annex"
			random_other_country = {
				limit = { 
					NOT = { tag = ROOT }
					original_tag = ROOT
					has_country_flag = yes_to_unification_flag
					is_subject = no
					has_government = ROOT
					has_war = no
					is_ai = no 
				}
				clr_country_flag = yes_to_unification_flag 
				clr_country_flag = unification_request_sent_flag
				every_other_country = {
					limit = { 
						original_tag = ROOT
						has_country_flag = yes_to_unification_flag
						is_subject = no
						has_government = ROOT
						has_war = no
					}
					clr_country_flag = yes_to_unification_flag
					PREV = { annex_country = { target = PREV transfer_troops = yes } }
				}
				news_event = {
					id = news.350
					hours = 8 
					random_hours = 8 
				}
			}
		}
		ELSE = {
			#log = "AI ROOT [ROOT.GetName] to annex"
			clr_country_flag = yes_to_unification_flag 
			clr_country_flag = unification_request_sent_flag
			every_other_country = {
				limit = {
					original_tag = ROOT
					has_country_flag = yes_to_unification_flag
					is_subject = no
					has_government = ROOT
					has_war = no
				}
				clr_country_flag = yes_to_unification_flag
				ROOT = { annex_country = { target = PREV transfer_troops = yes } }
			}
			news_event = {
				id = news.350
				hours = 8 
				random_hours = 8 
			}
		}
	}
}
	
country_event = {
	id = political.33
	title = political.33.t
	desc = political.33.desc

	picture = GFX_report_event_journalists_speech

	trigger = {
	}
	
	is_triggered_only = yes
	
	immediate = {
	}

	option = {
		name = political.33.a
		add_war_support = 0.1
	}
}
	