###########################
# USA Events
###########################

add_namespace = usa

# Amelia Eartharts wants to join the USAAC
country_event = {
	id = usa.1
	title = usa.1.t
	desc = usa.1.d
	picture = GFX_report_event_usa_amelia_earhart_airplane

	fire_only_once = yes
	
	trigger = {
		tag = USA
		has_war = yes
		NOT = { has_global_flag = earhart_disappeared }
	}
	
	mean_time_to_happen = {
		days = 30
	}
	
	option = { # Let her join
		name = usa.1.a
		add_political_power = -10
		add_ace = {
			name = "Amelia"
			surname = "Earhart"
			callsign = "Revenant"
			type = fighter_genius
			is_female = yes
		}
		set_country_flag = amelia_active_ace
	}
	option = { # Refuse
		name = usa.1.b
	}
}

# Pearl Harbor Gambit
country_event = {
	id = usa.3
	title = usa.3.t
	desc = usa.3.d
	picture = GFX_report_event_usa_pearl_harbor_airphoto

	fire_only_once = yes

	trigger = {
		tag = JAP
		USA = {
			focus_progress = {
				focus = USA_pearl_harbor_gambit
				progress > 0.1
			}
		}
	}

	mean_time_to_happen = {
		days = 21
		modifier = {
			factor = 0.5
			USA = {
				focus_progress = {
					focus = USA_pearl_harbor_gambit
					progress > 0.6
				}
			}
		}
	}

	option = {
		name = usa.3.a
		USA = {
			add_war_support = 0.5
		}
		create_wargoal = {
			type = take_state
			target = USA
			generator = { 629 } # Hawaii
		}
	}
}

# Destroyers for Bases
country_event = {
	id = usa.4
	title = usa.4.t
	desc = usa.4.d
	picture = GFX_report_event_usa_british_sailors_destroyers

	is_triggered_only = yes
	
	option = {
		name = usa.4.a
		custom_effect_tooltip = usa.4.a.tt
		hidden_effect = {
			if = {
				limit = { not = { has_dlc = "Man the Guns" } }
				ENG = {	load_oob = "ENG_destroyers_for_bases" }
				CAN = { load_oob = "CAN_destroyers_for_bases" }
			}
			else = {
				ENG = {	load_oob = "ENG_destroyers_for_bases_mtg" }
				CAN = { load_oob = "CAN_destroyers_for_bases_mtg" }
			}
			ENG = {
				if = { limit = { 696 = { is_controlled_by = ENG } }
					remove_state_core = 696
				}
				if = { limit = { 331 = { is_controlled_by = ENG } }
					remove_state_core = 331
				}
				if = { limit = { 308 = { is_controlled_by = ENG } } 
					remove_state_core = 308
				}
				if = { limit = { 1379 = { is_controlled_by = ENG } } 
					remove_state_core = 1379
				}
				if = { limit = { 1378 = { is_controlled_by = ENG } } 
					remove_state_core = 1378
				}
				if = { limit = { 1377 = { is_controlled_by = ENG } } 
					remove_state_core = 1377
				}
				if = { limit = { 693 = { is_controlled_by = ENG } } 
					remove_state_core = 693
				}
				if = { limit = { 689 = { is_controlled_by = ENG } } 
					remove_state_core = 689
				}
				if = { limit = { 691 = { is_controlled_by = ENG } } 
					remove_state_core = 691
				}
				if = { limit = { 1370 = { is_controlled_by = ENG } } 
					remove_state_core = 1370
				}
			}
		}
		USA = {
			if = { limit = { 696 = { is_controlled_by = ENG } }
				transfer_state = 696
			}
			if = { limit = { 331 = { is_controlled_by = ENG } }
				transfer_state = 331
			}
			if = { limit = { 308 = { is_controlled_by = ENG } } 
				transfer_state = 308
			}
			if = { limit = { 1379 = { is_controlled_by = ENG } } 
				transfer_state = 1379
			}
			if = { limit = { 1378 = { is_controlled_by = ENG } } 
				transfer_state = 1378
			}
			if = { limit = { 1377 = { is_controlled_by = ENG } } 
				transfer_state = 1377
			}
			if = { limit = { 693 = { is_controlled_by = ENG } } 
				transfer_state = 693
			}
			if = { limit = { 689 = { is_controlled_by = ENG } } 
				transfer_state = 689
			}
			if = { limit = { 691 = { is_controlled_by = ENG } } 
				transfer_state = 691
			}
			if = { limit = { 1370 = { is_controlled_by = ENG } } 
				transfer_state = 1370
			}
			add_opinion_modifier = {
				target = ROOT
				modifier = destroyers_for_bases_opinion
			}
			country_event = { id = usa.401 days = 3 }
		}
	}

	option = {
		name = usa.4.b
		USA = { country_event = { id = usa.5 days = 1 } }
		ai_chance = { factor = 0 }
	}

}

# Britain accepts offer
country_event = {
	id = usa.401
	title = usa.401.t
	desc = usa.401.desc
	picture = GFX_report_event_usa_destroyers

	is_triggered_only = yes
	
	option = { 
		name = usa.401.a
	}
}

# Britain refuses offer
country_event = {
	id = usa.5
	title = usa.5.t
	desc = usa.5.d
	picture = GFX_report_event_usa_destroyers

	is_triggered_only = yes
	
	option = { 
		name = usa.5.a
	}
}

# Election of 1936: Roosevelt vs Alf Landon
country_event = {
	id = usa.6
	title = usa.6.t
	desc = usa.6.d
	picture = GFX_report_event_usa_election_generic

	is_triggered_only = yes

	trigger = {
		tag = USA
		democratic > 0.5
		date > 1936.1.1
		date < 1937.1.1
	}

	immediate = {
		hidden_effect = {
			if = {
				limit = {
					OR = {
						has_completed_focus = USA_voter_registration_act
						has_completed_focus = USA_union_representation_act
					}
				}
				country_event = { id = usa.32 days = 730 } # midterms
			}
			else = {
				country_event = { id = usa.35 days = 730 } # midterms
			}
		}
	}

	option = { 	
		name = usa.6.a
		ai_chance = {
			factor = 75
			modifier = {
				OR = {
					has_game_rule = {
						rule = USA_ai_behavior
						option = FASCIST
					}
					has_country_flag = USA_AI_RANDOM_FASCIST
				}
				has_dlc = "Man the Guns"
				factor = 0
			}
		}		
		add_ideas = new_deal
		if = {
			limit = {
				OR = {
					has_completed_focus = USA_voter_registration_act
					has_completed_focus = USA_union_representation_act
				}
			}
			country_event = usa.32
		}
		else = {
			set_variable = { election_factor = random }
			add_to_variable = { election_factor = -0.5 }
			USA_election_senate = yes
			USA_election_house = yes
			custom_effect_tooltip = usa_congress_elections_tt_bad
			country_event = usa.30
		}
	}

	option = {
		name = usa.6.b
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0
				is_historical_focus_on = yes
				has_game_rule = {
					rule = USA_ai_behavior
					option = DEFAULT
				}
			}
		}		
		set_party_name = { ideology = democratic long_name = USA_republican_party name = USA_republican_party }
		set_variable = { election_factor = random }
		add_to_variable = { election_factor = -0.6 }
		USA_election_senate = yes
		USA_election_house = yes
		USA_flip_support = yes
		custom_effect_tooltip = usa_congress_elections_tt_good
		add_political_power = 120
		if = {
			limit = {
				has_idea = standard_oil_california
			}
			add_political_power = 150
		}
		if = {
			limit = {
				NOT = { has_idea = standard_oil_california }
			}
			add_ideas = standard_oil_california
		}
		create_country_leader = {
			name = "Alf Landon"
			desc = "POLITICS_ALF_LANDON_DESC"
			picture = GFX_portrait_Alf_Landon
			expire = "1965.1.1"
			ideology = conservatism
			traits = {
				staunch_constitutionalist
			}
		}
		country_event = usa.31
	}
}

# Election of 1940: Roosevelt vs Wendell Wilkie
country_event = {
	id = usa.7
	title = usa.7.t
	desc = usa.7.d
	picture = GFX_report_event_usa_election_roosevelt_wilkie

	is_triggered_only = yes

	trigger = {
		tag = USA
		democratic > 0.5
		date > 1940.1.1
		date < 1941.1.1
		has_idea = new_deal
	}

	immediate = {
		hidden_effect = {
			if = {
				limit = {
					OR = {
						has_completed_focus = USA_voter_registration_act
						has_completed_focus = USA_union_representation_act
					}
				}
				country_event = { id = usa.32 days = 730 } # midterms
			}
			else = {
				country_event = { id = usa.35 days = 730 } # midterms
			}
		}
	}
	
	option = {
		name = usa.7.a
		ai_chance = {
			factor = 75
		}
		if = {
			limit = {
				OR = {
					has_completed_focus = USA_voter_registration_act
					has_completed_focus = USA_union_representation_act
				}
			}
			country_event = usa.32
		}
		else = {
			set_variable = { election_factor = random }
			add_to_variable = { election_factor = -0.5 }
			USA_election_senate = yes
			USA_election_house = yes
			custom_effect_tooltip = usa_congress_elections_tt_bad
			country_event = usa.30
		}
	}

	option = {
		name = usa.7.b
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}	
		set_party_name = { ideology = democratic long_name = USA_republican_party name = USA_republican_party }
		remove_ideas = new_deal
		add_ideas = wilkies_new_deal
		set_variable = { election_factor = random }
		add_to_variable = { election_factor = -0.6 }
		add_political_power = 120
		USA_election_senate = yes
		USA_election_house = yes
		USA_flip_support = yes
		custom_effect_tooltip = usa_congress_elections_tt_good
		create_country_leader = {
			name = "Wendell Wilkie"
			desc = "POLITICS_WENDELL_WILKIE_DESC"
			picture = GFX_portrait_Wendell_Wilkie
			expire = "1965.1.1"
			ideology = liberalism
			traits = {
				
			}
		}
		country_event = usa.31 #weighted towards gain of support
	}
}

# Election of 1940: Roosevelt vs Landon (Incumbent)
country_event = {
	id = usa.8
	title = usa.8.t
	desc = usa.8.d
	picture = GFX_report_event_usa_election_landon_roosevelt

	is_triggered_only = yes

	trigger = {
		tag = USA
		democratic > 0.5
		date > 1940.1.1
		date < 1941.1.1
		NOT = { has_idea = new_deal }
	}

	immediate = {
		hidden_effect = {
			if = {
				limit = {
					OR = {
						has_completed_focus = USA_voter_registration_act
						has_completed_focus = USA_union_representation_act
					}
				}
				country_event = { id = usa.32 days = 730 } # midterms
			}
			else = {
				country_event = { id = usa.35 days = 730 } # midterms
			}
		}
	}
	
	option = { 
		name = usa.8.a
		add_political_power = -40
		if = {
			limit = {
				OR = {
					has_completed_focus = USA_voter_registration_act
					has_completed_focus = USA_union_representation_act
				}
			}
			country_event = usa.32
		}
		else = {
			set_variable = { election_factor = random }
			add_to_variable = { election_factor = -0.5 }
			USA_election_senate = yes
			USA_election_house = yes
			custom_effect_tooltip = usa_congress_elections_tt_bad
			country_event = usa.30
		}
	}

	option = { 
		name = usa.8.b
		set_party_name = { ideology = democratic long_name = USA_democratic_party name = USA_democratic_party }
		add_ideas = new_deal
		retire_country_leader = yes
		add_political_power = 120
		set_variable = { election_factor = random }
		add_to_variable = { election_factor = -0.6 }
		USA_election_senate = yes
		USA_election_house = yes
		USA_flip_support = yes
		custom_effect_tooltip = usa_congress_elections_tt_good
		country_event = usa.31
	}
}

# Election of 1944: Roosevelt vs Thomas E. Dewey
country_event = {
	id = usa.9
	title = usa.9.t
	desc = usa.9.d
	picture = GFX_report_event_usa_election_roosevelt_dewey

	is_triggered_only = yes
	immediate = {
		hidden_effect = {
			if = {
				limit = {
					OR = {
						has_completed_focus = USA_voter_registration_act
						has_completed_focus = USA_union_representation_act
					}
				}
				country_event = { id = usa.32 days = 730 } # midterms
			}
			else = {
				country_event = { id = usa.35 days = 730 } # midterms
			}
		}
	}
	trigger = {
		tag = USA
		democratic > 0.5
		date > 1944.1.1
		date < 1945.1.1
		has_idea = new_deal
		has_war = no
	}
	
	option = {
		name = usa.9.a
		ai_chance = {
			factor = 75
		}
		add_political_power = 10
		if = {
			limit = {
				OR = {
					has_completed_focus = USA_voter_registration_act
					has_completed_focus = USA_union_representation_act
				}
			}
			country_event = usa.32
		}
		else = {
			set_variable = { election_factor = random }
			add_to_variable = { election_factor = -0.5 }
			USA_election_senate = yes
			USA_election_house = yes
			custom_effect_tooltip = usa_congress_elections_tt_bad
			country_event = usa.30
		}
	}

	option = {
		name = usa.9.b
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}		
		remove_ideas = new_deal
		set_party_name = { ideology = democratic long_name = USA_republican_party name = USA_republican_party }
		set_variable = { election_factor = random }
		add_to_variable = { election_factor = -0.6 }
		USA_election_senate = yes
		USA_election_house = yes
		USA_flip_support = yes
		add_political_power = 120
		custom_effect_tooltip = usa_congress_elections_tt_good
		create_country_leader = {
			name = "Thomas E. Dewey"
			desc = "POLITICS_THOMAS_DEWEY_DESC"
			picture = GFX_portrait_Thomas_E_Dewey
			expire = "1965.1.1"
			ideology = conservatism
			traits = {
				
			}
		}
		country_event = usa.31
	}
}

# Election of 1944: Roosevelt vs Incumbent
country_event = {
	id = usa.10
	title = usa.10.t
	desc = usa.10.d
	picture = GFX_report_event_usa_election_generic

	is_triggered_only = yes
	immediate = {
		hidden_effect = {
			if = {
				limit = {
					OR = {
						has_completed_focus = USA_voter_registration_act
						has_completed_focus = USA_union_representation_act
					}
				}
				country_event = { id = usa.32 days = 730 } # midterms
			}
			else = {
				country_event = { id = usa.35 days = 730 } # midterms
			}
		}
	}
	trigger = {
		tag = USA
		democratic > 0.5
		date > 1944.1.1
		date < 1945.1.1
		NOT = { has_idea = new_deal }
	}
	
	option = { 
		name = usa.10.a
		add_political_power = 10
		if = {
			limit = {
				OR = {
					has_completed_focus = USA_voter_registration_act
					has_completed_focus = USA_union_representation_act
				}
			}
			country_event = usa.32
		}
		else = {
			set_variable = { election_factor = random }
			add_to_variable = { election_factor = -0.5 }
			USA_election_senate = yes
			USA_election_house = yes
			custom_effect_tooltip = usa_congress_elections_tt_bad
			country_event = usa.30
		}
	}

	option = { 
		name = usa.10.b
		add_ideas = new_deal
		set_party_name = { ideology = democratic long_name = USA_democratic_party name = USA_democratic_party }
		set_variable = { election_factor = random }
		add_to_variable = { election_factor = -0.6 }
		USA_election_senate = yes
		USA_election_house = yes
		USA_flip_support = yes
		add_political_power = 120
		custom_effect_tooltip = usa_congress_elections_tt_good
		if = {
			limit = { has_idea = wilkies_new_deal }
			remove_ideas = wilkies_new_deal
		}
		retire_country_leader = yes
		country_event = usa.31
	}
}

# Election of 1944: Roosevelt vs MacArthur
country_event = {
	id = usa.11
	title = usa.11.t
	desc = usa.11.d
	picture = GFX_report_event_usa_election_roosevelt_macarthur

	is_triggered_only = yes
	immediate = {
		hidden_effect = {
			if = {
				limit = {
					OR = {
						has_completed_focus = USA_voter_registration_act
						has_completed_focus = USA_union_representation_act
					}
				}
				country_event = { id = usa.32 days = 730 } # midterms
			}
			else = {
				country_event = { id = usa.35 days = 730 } # midterms
			}
		}
	}
	trigger = {
		tag = USA
		democratic > 0.5
		date > 1944.1.1
		date < 1945.1.1
		has_idea = new_deal
		OR = {
			has_war = no
			has_country_flag = macarthur_candidate
		}
	}
	
	option = {
		name = usa.11.a
		ai_chance = {
			factor = 25
		}	
		add_political_power = 10
		if = {
			limit = {
				OR = {
					has_completed_focus = USA_voter_registration_act
					has_completed_focus = USA_union_representation_act
				}
			}
			country_event = usa.32
		}
		else = {
			set_variable = { election_factor = random }
			add_to_variable = { election_factor = -0.5 }
			USA_election_senate = yes
			USA_election_house = yes
			custom_effect_tooltip = usa_congress_elections_tt_bad
			country_event = usa.30
		}
	}

	option = {
		name = usa.11.b
		ai_chance = {
			factor = 25
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}
		remove_ideas = new_deal
		set_party_name = { ideology = democratic long_name = USA_republican_party name = USA_republican_party }
		set_variable = { election_factor = random }
		add_to_variable = { election_factor = -0.6 }
		USA_election_senate = yes
		USA_election_house = yes
		USA_flip_support = yes
		add_political_power = 120
		custom_effect_tooltip = usa_congress_elections_tt_good
		create_country_leader = {
			name = "Douglas MacArthur"
			desc = "POLITICS_DOUGLAS_MACARTHUR_DESC"
			picture = GFX_portrait_Douglas_MacArthur
			expire = "1965.1.1"
			ideology = conservatism
			traits = {
				
			}
		}
		country_event = usa.31
		USA_douglas_macarthur = { remove_unit_leader_role = yes }
	}
}

# Election of 1944: MacArthur Candidate?
country_event = {
	id = usa.12
	title = usa.12.t
	desc = usa.12.d
	picture = GFX_report_event_usa_macarthur_speech

	is_triggered_only = yes

	trigger = {
		tag = USA
		democratic > 0.5
		date > 1944.1.1
		date < 1945.1.1
		has_idea = new_deal
		has_war = yes
	}
	
	option = { 
		name = usa.12.a
		country_event = { id = usa.9 }
	}

	option = { 
		name = usa.12.b
		country_event = { id = usa.11 }
	}
}

# Roosevelt Dies
country_event = {
	id = usa.13
	title = usa.13.t
	desc = usa.13.d
	picture = GFX_report_event_usa_funeral

	trigger = {
		tag = USA
		date > 1945.3.29
		has_idea = new_deal
		has_government = democratic
	}

	fire_only_once = yes

	mean_time_to_happen = {
		days = 365
	}
	
	option = {
		name = usa.13.a
		add_political_power = -40
		kill_country_leader = yes
		create_country_leader = {
			name = "Harry S. Truman"
			desc = "POLITICS_HARRY_TRUMAN_DESC"
			picture = GFX_portrait_Harry_S_Truman
			expire = "1965.1.1"
			ideology = liberalism
			traits = {
				
			}
		}
	}
}

# Fascist US reacts to Commienazis 
country_event = {
	id = usa.14
	title = usa.14.t
	desc = usa.14.d
	picture = GFX_report_event_molotov_ribentrop_handshake

	is_triggered_only = yes

	trigger = {
		tag = USA
		has_government = fascism
		is_puppet = no
	}
	
	option = { 
		name = usa.14.a
		set_politics = {
			ruling_party = democratic
			elections_allowed = yes
		}
		set_political_party = {
			ideology = democratic
			popularity = 50
		}
		remove_ideas = great_depression
		add_war_support = 0.2
		add_timed_idea = { idea = fascism_defeated days = 730 }
		if = {
			limit = {
				ENG = {
					is_faction_leader = yes
					NOT = { has_war_with = USA }
				}
			}
			ENG = { add_to_faction = USA }
			USA = {
				add_ai_strategy = {
					type = alliance
					id = "ENG"
					value = 200
				}
			}
		}
		add_opinion_modifier = { target = GER modifier = unholy_alliance }
	}

	option = {
		name = usa.14.b
		ai_chance = { factor = 0 }
	}
}

#DO NOT USE USA.15 AS EVENT ID
#It will make the event text pop up as the name or requirement for two radar technologies for Finland if they are Fascist due to a hash conflict.


# USA option to intervene in war
# Hidden event to get scopes set up 
country_event = {
	id = usa.16

	is_triggered_only = yes
	
	hidden = yes

	immediate = {
		save_event_target_as = being_attacked
		USA = {
			country_event = { id = usa.17 }
		}
	}
}

# USA option to intervene in war 
country_event = {
	id = usa.17
	title = usa.17.t
	desc = usa.17.d
	picture = GFX_report_event_usa_macarthur_speech

	is_triggered_only = yes
	
	#Intervene ultimatum war
	option = { 
		name = usa.17.a
	
		#Need to use FROM FROM scope since the one sending the event is the nation under attack
		ai_chance = {
			factor = 20			
			modifier = {
				factor = 0.2
				FROM = {
					FROM = {
						strength_ratio = {
							tag = USA
							ratio > 0.8
						}
					}
				}
			}		
		}

		custom_effect_tooltip = usa.17.a_tt
		FROM = { FROM = { country_event = { id = usa.18 days = 2 } } }
	}

	#Don't Intervene
	option = {
		name = usa.17.b

		ai_chance = {
			factor = 5
			modifier = {
				factor = 0
				FROM = {
					FROM = {
						strength_ratio = {
							tag = USA
							ratio < 0.5
						}
					}
				}
			}
		}
	}
}

# Country response to USA intervening
country_event = {
	id = usa.18
	title = usa.18.t
	desc = usa.18.d
	picture = GFX_report_event_soldiers_marching

	is_triggered_only = yes
	
	#Go to war with USA
	option = { 
		name = usa.18.a

		ai_chance = {
			factor = 10
			modifier = {
				factor = 0.5
				strength_ratio = {
					tag = USA
					ratio < 0.7
				}
				is_in_faction = yes
			}
			modifier = {
				factor = 5
				strength_ratio = {
					tag = USA
					ratio > 0.7
				}
			}
		}

		event_target:being_attacked = {
			FROM = {
				add_to_war = {
					targeted_alliance = PREV
					enemy = ROOT
					hostility_reason = guarantee
				}
			}
		}

		#ROOT = {
		#	declare_war_on = {
		#		target = FROM
		#	}
		#}
		hidden_effect = {
			news_event = { id = news.157 days = 2 }
		}
	}

	#Back down
	option = {
		name = usa.18.b

		ai_chance = { 
			factor = 10
			modifier = {
				factor = 10
				strength_ratio = {
					tag = USA
					ratio < 0.7
				}
				is_in_faction = no
			}			
		}

		custom_effect_tooltip = usa.18.b_tt
		hidden_effect = {
			event_target:being_attacked = { white_peace = ROOT }
			news_event = { id = news.158 days = 2 }
		}
	}
}
country_event = {
	id = usa.19
	title = usa.19.t

	is_triggered_only = yes
	
	hidden = yes

	immediate = {
		USA = {
			create_wargoal = {
				type = puppet_wargoal_focus
				target = ROOT
			}
		}
	}
}

# US supports democracy 
country_event = {
	id = usa.20
	title = usa.20.t
	desc = usa.20.d
	picture = GFX_report_event_usa_election_generic

	is_triggered_only = yes

	immediate = {
		set_country_flag = usa_influence_fired
	}

	option = {
		name = usa.20.a		
		custom_effect_tooltip = usa.20.a_tt
	}
}

# US supports communism
country_event = {
	id = usa.21
	title = usa.20.t
	desc = usa.21.d
	picture = GFX_report_event_usa_election_generic
	
	is_triggered_only = yes

	immediate = {
		set_country_flag = usa_influence_fired
	}

	option = {
		name = usa.20.a
		custom_effect_tooltip = usa.20.a_tt
	}
}

# US supports fascism
country_event = {
	id = usa.22
	title = usa.20.t
	desc = usa.22.d
	picture = GFX_report_event_usa_election_generic

	is_triggered_only = yes

	immediate = {
		set_country_flag = usa_influence_fired
	}

	option = {
		name = usa.20.a	
		custom_effect_tooltip = usa.20.a_tt
	}

}

# US extends influence to protection. Will meddle in wars
country_event = {
	id = usa.23
	title = usa.23.t
	desc = usa.23.d
	picture = GFX_report_event_usa_heavy_cruiser

	is_triggered_only = yes

	option = {
		name = usa.23.a
		custom_effect_tooltip = usa.23.a_tt
	}

}


# Communist US reacts to Commienazis 
country_event = {
	id = usa.24
	title = usa.24.t
	desc = usa.24.d
	picture = GFX_report_event_molotov_ribentrop_handshake

	is_triggered_only = yes

	trigger = {
		tag = USA
		has_government = communism 
		is_puppet = no
	}
	
	option = { 
		name = usa.24.a
		set_politics = {
			ruling_party = democratic
			elections_allowed = yes
		}
		set_political_party = {
			ideology = democratic
			popularity = 50
		}
		remove_ideas = great_depression
		add_war_support = 0.2
		add_timed_idea = { idea = communism_defeated days = 730 }
		if = {
			limit = {
				ENG = {
					is_faction_leader = yes
					NOT = { has_war_with = USA }
				}
			}
			ENG = { add_to_faction = USA }
			USA = {
				add_ai_strategy = {
					type = alliance
					id = "ENG"
					value = 200
				}
			}
		}
		add_opinion_modifier = { target = GER modifier = unholy_alliance }
		add_opinion_modifier = { target = SOV modifier = unholy_alliance }
	}

	option = {
		name = usa.24.b
		ai_chance = { factor = 0 }
	}
}

# US congress elections - outcome
country_event = {
	id = usa.30
	title = usa.30.t
	desc = usa.30.desc
	picture = GFX_report_event_election_vote

	is_triggered_only = yes

	option = {
		name = usa.30.a
		clear_variable = sen_loc
		clear_variable = ror_loc
		clear_variable = senators_for_reelection
		clear_variable = representatives_for_reelection
	}

}
# elections - new president, opposition/support switch roles
country_event = {
	id = usa.31
	title = usa.31.t
	desc = usa.31.desc
	picture = GFX_report_event_usa_election_generic

	is_triggered_only = yes

	option = {
		name = usa.31.a
		clear_variable = sen_loc
		clear_variable = ror_loc
		clear_variable = senators_for_reelection
		clear_variable = representatives_for_reelection
	}

}
# elections in the US - player has a majority guaranteed
country_event = {
	id = usa.32
	title = usa.32.t
	desc = usa.32.desc
	picture = GFX_report_event_election_vote

	is_triggered_only = yes
	trigger = {
		OR = {
			has_completed_focus = USA_voter_registration_act
			has_completed_focus = USA_union_representation_act
		}
	}

	option = {
		name = usa.32.a
		USA_return_majority = yes
	}

}

#midterm elections
country_event = {
	id = usa.35
	title = usa.35.t
	desc = usa.35.desc
	picture = GFX_report_event_election_vote
	hidden = yes
	is_triggered_only = yes

	immediate = {
		if = {
			limit = {
				NOT = {
					OR = {
						has_completed_focus = USA_voter_registration_act
						has_completed_focus = USA_union_representation_act
					}
				}
			}
			random_list = {
				50 = {
					set_variable = { election_factor = random }
					add_to_variable = { election_factor = -0.6 }
					USA_election_senate = yes
					USA_election_house = yes
					country_event = usa.30
				}
				50 = {
					set_variable = { election_factor = random }
					add_to_variable = { election_factor = -0.3 }
					USA_election_senate = yes
					USA_election_house = yes
					country_event = usa.30
				}
			}
		}
		else = {
			country_event = usa.32
		}
	}

	option = {
		name = usa.35.a
		
	}

}
#small support event - senate
country_event = {
	id = usa.40
	title = usa.40.t
	desc = usa.40.desc
	picture = GFX_report_event_FDR_speech

	is_triggered_only = yes
	trigger = {
		tag = USA
		NOT = {
			OR = {
				has_completed_focus = USA_voter_registration_act
				has_completed_focus = USA_union_representation_act
			}
		}
	}

	option = {
		name = usa.40.a
		USA_senate_small_support = yes
		hidden_effect = {
			country_event = { id = usa.50 days = 70 random_days = 10 }
		}
	}

}
# small support event - house
country_event = {
	id = usa.41
	title = usa.41.t
	desc = usa.41.desc
	picture = GFX_report_event_FDR_speech

	is_triggered_only = yes
	trigger = {
		tag = USA
		NOT = {
			OR = {
				has_completed_focus = USA_voter_registration_act
				has_completed_focus = USA_union_representation_act
			}
		}
	}

	option = {
		name = usa.41.a
		USA_house_small_support = yes
		hidden_effect = {
			country_event = { id = usa.51 days = 70 random_days = 10 }
		}
	}

}

#small opposition event - senate
country_event = {
	id = usa.42
	title = usa.42.t
	desc = usa.42.desc
	picture = GFX_report_event_journalists_speech

	is_triggered_only = yes
	
	trigger = {
		tag = USA
		NOT = {
			OR = {
				has_completed_focus = USA_voter_registration_act
				has_completed_focus = USA_union_representation_act
			}
		}
	}

	option = {
		name = usa.42.a
		USA_senate_small_opposition = yes
		hidden_effect = {
			country_event = { id = usa.50 days = 70 random_days = 10 }
		}
	}

}
# small opposition event - house
country_event = {
	id = usa.43
	title = usa.43.t
	desc = usa.43.desc
	picture = GFX_report_event_journalists_speech

	is_triggered_only = yes
	trigger = {
		tag = USA
		NOT = {
			OR = {
				has_completed_focus = USA_voter_registration_act
				has_completed_focus = USA_union_representation_act
			}
		}
	}

	option = {
		name = usa.43.a
		USA_house_small_opposition = yes
		hidden_effect = {
			country_event = { id = usa.51 days = 70 random_days = 10 }
		}
	}

}

#medium support event - senate
country_event = {
	id = usa.44
	title = usa.44.t
	desc = usa.44.desc
	picture = GFX_report_event_FDR_speech

	is_triggered_only = yes
	trigger = {
		tag = USA
		NOT = {
			OR = {
				has_completed_focus = USA_voter_registration_act
				has_completed_focus = USA_union_representation_act
			}
		}
	}

	option = {
		name = usa.44.a
		USA_senate_medium_support = yes
		hidden_effect = {
			country_event = { id = usa.50 days = 70 random_days = 20 }
		}
	}

}
# medium support event - house
country_event = {
	id = usa.45
	title = usa.45.t
	desc = usa.45.desc
	picture = GFX_report_event_FDR_speech

	is_triggered_only = yes
	trigger = {
		tag = USA
		NOT = {
			OR = {
				has_completed_focus = USA_voter_registration_act
				has_completed_focus = USA_union_representation_act
			}
		}
	}

	option = {
		name = usa.45.a
		USA_house_medium_support = yes
		hidden_effect = {
			country_event = { id = usa.51 days = 70 random_days = 10 }
		}
	}

}

#medium opposition event - senate
country_event = {
	id = usa.46
	title = usa.46.t
	desc = usa.46.desc
	picture = GFX_report_event_journalists_speech

	is_triggered_only = yes
	trigger = {
		tag = USA
		NOT = {
			OR = {
				has_completed_focus = USA_voter_registration_act
				has_completed_focus = USA_union_representation_act
			}
		}
	}

	option = {
		name = usa.46.a
		USA_senate_medium_opposition = yes
		hidden_effect = {
			country_event = { id = usa.50 days = 70 random_days = 20 }
		}
	}

}
# medium opposition event - house
country_event = {
	id = usa.47
	title = usa.47.t
	desc = usa.47.desc
	picture = GFX_report_event_journalists_speech

	is_triggered_only = yes
	trigger = {
		tag = USA
		NOT = {
			OR = {
				has_completed_focus = USA_voter_registration_act
				has_completed_focus = USA_union_representation_act
			}
		}
	}

	option = {
		name = usa.47.a
		USA_house_medium_opposition = yes
		hidden_effect = {
			country_event = { id = usa.51 days = 70 random_days = 10 }
		}
	}

}

# dispatcher event - senate
country_event = {
	id = usa.50
	Hidden = yes
	is_triggered_only = yes
	trigger = {
		tag = USA
		NOT = {
			OR = {
				has_completed_focus = USA_voter_registration_act
				has_completed_focus = USA_union_representation_act
			}
		}
	}

	immediate = {
		random_list = {
			20 = { 
				modifier = {
					not = { congress_medium_support_trigger = yes }
					factor = 1.25
				}
				modifier = {
					not = { congress_low_support_trigger = yes }
					factor = 2
				}
				country_event = { id = usa.40 days = 15 random_days = 6 } #small support
			} 
			20 = { 
				modifier = {
					check_variable = { var = senators_support value = quorum_high compare = greater_than_or_equals }
					factor = 3
				}
				modifier = {
					has_idea_with_trait = fascist_demagogue
					factor = 2
				}
				modifier = {
					has_idea_with_trait = communist_revolutionary
					factor = 2
				}
				country_event = { id = usa.42 days = 20 random_days = 6 } #small opposition 
			} 
			15 = { 
				modifier = {
					not = { congress_medium_support_trigger = yes }
					factor = 1.25
				}
				modifier = {
					not = { congress_low_support_trigger = yes }
					factor = 2
				}
				country_event = { id = usa.44 days = 20 random_days = 10 } #medium support
			} 
			15 = { 
				modifier = {
					check_variable = { var = senators_support value = quorum_high compare = greater_than_or_equals }
					factor = 3
				}
				modifier = {
					has_idea_with_trait = fascist_demagogue
					factor = 2
				}
				modifier = {
					has_idea_with_trait = communist_revolutionary
					factor = 2
				}
				country_event = { id = usa.46 days = 20 random_days = 10 }  #medium opposition
			}
			30 = { #investment opportunity
				modifier = {
					has_country_flag = USA_congress_investment
					factor = 0
				}
				modifier = {
					has_completed_focus = USA_wpa
					factor = 1.5
				} 
				country_event = { id = usa.60 days = 10 random_days = 15 } 
			} 
		}
	}
}

# dispatcher event - house
country_event = {
	id = usa.51
	Hidden = yes
	is_triggered_only = yes
	trigger = {
		tag = USA
		NOT = {
			OR = {
				has_completed_focus = USA_voter_registration_act
				has_completed_focus = USA_union_representation_act
			}
		}
	}

	immediate = {
		random_list = {
			35 = { 
				modifier = {
					check_variable = { representatives_support < 218 }
					factor = 1.5
				}
				modifier = {
					check_variable = { representatives_support < 180 }
					factor = 3
				}
				country_event = { id = usa.41 days = 15 random_days = 6 } #small support
			} 
			25 = {
				modifier = {
					check_variable = { representatives_support > 260 }
					factor = 2
				}
				modifier = {
					check_variable = { representatives_support < 180 }
					factor = 0.5
				}
				modifier = {
					has_idea_with_trait = fascist_demagogue
					factor = 2
				}
				modifier = {
					has_idea_with_trait = communist_revolutionary
					factor = 2
				} 
				country_event = { id = usa.43 days = 20 random_days = 6 } #small opposition
			} 
			25 = { 
				modifier = {
					check_variable = { representatives_support < 180 }
					factor = 1.5
				}
				modifier = {
					check_variable = { representatives_support < 100 }
					factor = 10
				}
				country_event = { id = usa.45 days = 25 random_days = 10 } #medium support
			} 
			15 = { 
				modifier = {
					check_variable = { representatives_support > 260 }
					factor = 2
				}
				modifier = {
					check_variable = { representatives_support > 400 }
					factor = 10
				}
				modifier = {
					check_variable = { representatives_support < 180 }
					factor = 0.5
				}
				modifier = {
					check_variable = { representatives_support < 100 }
					factor = 0
				}
				modifier = {
					has_idea_with_trait = fascist_demagogue
					factor = 2
				}
				modifier = {
					has_idea_with_trait = communist_revolutionary
					factor = 2
				}
				country_event = { id = usa.47 days = 30 random_days = 15 } #medium opposition
			} 
		}
	}
}
# senator wants investment in their state - hidden dispatch event
country_event = {
	id = usa.60
	hidden = yes
	is_triggered_only = yes
	trigger = {
		tag = USA
		NOT = {
			OR = {
				has_completed_focus = USA_voter_registration_act
				has_completed_focus = USA_union_representation_act
			}
		}
	}

	immediate = {
		set_country_flag = USA_congress_investment
		if = {
			limit = { has_event_target = USA_congress_investment_state }
			clear_global_event_target = USA_congress_investment_state
		}
		random_list = {
			25 = {
				modifier = {
					NOT = {
						any_owned_state = {
							is_core_of = ROOT
							is_controlled_by = ROOT
							free_building_slots = {
								building = industrial_complex
								size > 0
								include_locked = no
							}
						}
					}
					factor = 0
				}
				random_owned_state = {
					limit = {
						is_core_of = ROOT
						is_controlled_by = ROOT
						free_building_slots = {
							building = industrial_complex
							size > 0
							include_locked = no
						}
					}
					
					save_global_event_target_as = USA_congress_investment_state
					state_event = { id = usa.61 trigger_for = controller }
				}
			}
			25 = {
				modifier = {
					NOT = {
						any_owned_state = {
							is_core_of = ROOT
							is_controlled_by = ROOT
							free_building_slots = {
								building = arms_factory
								size > 0
								include_locked = no
							}
						}
					}
					factor = 0
				}
				modifier = {
					has_completed_focus = USA_military_construction
					factor = 2
				}
				random_owned_state = {
					limit = {
						is_core_of = ROOT
						is_controlled_by = ROOT
						free_building_slots = {
							building = arms_factory
							size > 0
							include_locked = no
						}
					}
					save_global_event_target_as = USA_congress_investment_state
					state_event = { id = usa.62 trigger_for = controller }
				}
			}
			25 = { 
				modifier = {
					NOT = {
						any_owned_state = {
							is_core_of = ROOT
							is_controlled_by = ROOT
							is_coastal = yes
							free_building_slots = {
								building = dockyard
								size > 0
								include_locked = no
							}
						}
					}
					factor = 0
				}
				random_owned_state = {
					limit = {
						is_core_of = ROOT
						is_controlled_by = ROOT
						free_building_slots = {
							building = dockyard
							size > 0
							include_locked = no
						}
					}
					save_global_event_target_as = USA_congress_investment_state
					state_event = { id = usa.64 trigger_for = controller }
				}
			}
			25 = {
				modifier = {
					NOT = {
						any_owned_state = {
							is_core_of = ROOT
							free_building_slots = {
								building = infrastructure
								size > 0
								include_locked = no
							}
						}
					}
					factor = 0
				}
				modifier = {
					has_completed_focus = USA_USACE_projects
					factor = 2
				}
				random_owned_state = {
					limit = {
						is_core_of = ROOT
						is_controlled_by = ROOT
						free_building_slots = {
							building = infrastructure
							size > 0
							include_locked = no
						}
					}
					save_global_event_target_as = USA_congress_investment_state
					state_event = { id = usa.63 trigger_for = controller }
				}
			}
		}
		hidden_effect = {
			country_event = { id = usa.50 days = 70 random_days = 10 }
		}
	}
}
# senator wants investment in civilian factory
country_event = {
	id = usa.61
	title = usa.61.t
	desc = usa.61.desc
	picture = GFX_report_event_generic_sign_treaty3
	
	is_triggered_only = yes
	

	option = {
		name = usa.61.a #accept
		ai_chance = {
			factor = 0
		}
		unlock_decision_tooltip = { decision = USA_invest_in_state_factory show_effect_tooltip = yes }
		event_target:USA_congress_investment_state = {
			set_state_flag = USA_congress_build_factory
			set_variable = { factory_goal = industrial_complex_level }
			add_to_variable = { factory_goal = 1 }
		}
	}
	option = {
		name = usa.61.b #refuse
		ai_chance = {
			factor = 100
		}
		ROOT = { clr_country_flag = USA_congress_investment }
		clear_global_event_target = USA_congress_investment_state
	}
}

# senator wants investment in military factory
country_event = {
	id = usa.62
	title = usa.61.t
	desc = usa.62.desc
	picture = GFX_report_event_tank_factory
	
	is_triggered_only = yes
	

	option = {
		name = usa.62.a #accept
		ai_chance = {
			factor = 0
		}
		unlock_decision_tooltip = { decision = USA_invest_in_state_arms_factory show_effect_tooltip = yes }
		event_target:USA_congress_investment_state = {
			set_state_flag = USA_congress_build_arms_factory
			set_variable = { arms_factory_goal = arms_factory_level }
			add_to_variable = { arms_factory_goal = 1 }
		}
	}
	option = {
		name = usa.62.b #refuse
		ai_chance = {
			factor = 100
		}
		ROOT = { clr_country_flag = USA_congress_investment }
		clear_global_event_target = USA_congress_investment_state
	}
}
# senator wants investment in infrastructure
country_event = {
	id = usa.63
	title = usa.63.t
	desc = usa.63.desc
	picture = GFX_report_event_generic_train
	
	is_triggered_only = yes
	

	option = {
		name = usa.63.a #accept
		ai_chance = {
			factor = 0
		}
		unlock_decision_tooltip = { decision = USA_invest_in_state_infrastructure show_effect_tooltip = yes }
		event_target:USA_congress_investment_state = {
			set_state_flag = USA_congress_build_infrastructure
			set_variable = { infrastructure_goal = infrastructure_level }
			add_to_variable = { infrastructure_goal = 1 }
		}
	}
	option = {
		name = usa.63.b #refuse
		ai_chance = {
			factor = 100
		}
		ROOT = { clr_country_flag = USA_congress_investment }
		clear_global_event_target = USA_congress_investment_state
	}
}
# senator wants investment in dockyards
country_event = {
	id = usa.64
	title = usa.64.t
	desc = usa.64.desc
	picture = GFX_report_event_ast_navy
	
	is_triggered_only = yes
	

	option = {
		name = usa.64.a #accept
		ai_chance = {
			factor = 0
		}
		unlock_decision_tooltip = { decision = USA_invest_in_state_dockyard show_effect_tooltip = yes }
		event_target:USA_congress_investment_state = {
			set_state_flag = USA_congress_build_dockyard
			set_variable = { dockyard_goal = building_level@dockyard }
			add_to_variable = { dockyard_goal = 1 }
		}
	}
	option = {
		name = usa.64.b #refuse
		ai_chance = {
			factor = 100
		}
		ROOT = { clr_country_flag = USA_congress_investment }
		clear_global_event_target = USA_congress_investment_state
	}
}

country_event = {
	id = usa.176 #Fire arsenal of democracy speech
	
	fire_only_once = yes
	
	trigger = {
		tag = USA
		has_war = yes
		has_war_with = GER
		date > 1939.1.1
	}
	
	mean_time_to_happen = {
		days = 30
	}
	
	hidden = yes

	immediate = {
		play_arsenal_of_democracy_effect = yes
	}
}