﻿###########################
# 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
	}
}

# World Police
country_event = {
	id = usa.2
	title = usa.2.t
	desc = usa.2.d
	picture = GFX_report_event_usa_heavy_cruiser

	is_triggered_only = yes

	
	option = { 
		name = usa.2.a
		every_other_country = {
			limit = {
				OR = {
					has_government = fascism
					has_government = communism
				}
			}
			save_event_target_as = war_target
			ROOT = {
				create_wargoal = { type = annex_everything target = event_target:war_target }
			}
		}
	}

}

# Pearl Harbor Gambit // Wyvern tribe is winner
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 = BOT
		NOT = { country_exists = ETH }
		NOT = { country_exists = MZB }
		NOT = { country_exists = ZIM }
		NOT = { country_exists = COG }
	}

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

	option = {
		name = usa.3.a
		add_stability = 0.1
		add_war_support = 0.05

		set_rule = { can_puppet = yes }
		set_rule = { can_join_factions = yes }
		set_rule = { can_not_declare_war = no }
		set_rule = { can_join_factions = yes }
	}
}

# 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 = {
			ENG = {	load_oob = "ENG_destroyers_for_bases" }
			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 = { 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
				}
			}
			CAN = { load_oob = "CAN_destroyers_for_bases" }
		}
		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 = { 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
			}
			add_opinion_modifier = {
				target = ROOT
				modifier = destroyers_for_bases_opinion
			}
		}
	}

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

}

# Lizard tribe number one
country_event = {
	id = usa.5
	title = usa.3.t
	desc = usa.3.d
	picture = GFX_report_event_usa_pearl_harbor_airphoto

	fire_only_once = yes

	trigger = {
		tag = ETH
		NOT = { country_exists = BOT }
		NOT = { country_exists = MZB }
		NOT = { country_exists = ZIM }
		NOT = { country_exists = COG }
	}

	mean_time_to_happen = {
		days = 7
	}
	
	option = {
		name = usa.3.a
		add_stability = 0.1
		add_war_support = 0.05

		set_rule = { can_puppet = yes }
		set_rule = { can_join_factions = yes }
		set_rule = { can_not_declare_war = no }
		set_rule = { can_join_factions = yes }
	}
}

# 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
	}
	
	option = { 	
		name = usa.6.a
		ai_chance = {
			factor = 75
		}		
		add_ideas = new_deal
	}

	option = { 
		name = usa.6.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 }
		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 = "Portrait_USA_Generic_2.dds"
			expire = "1965.1.1"
			ideology = conservatism
			traits = {
				staunch_constitutionalist
			}
		}
	}
}

# Election of 1940: Roosevelt vs Wendell Wilkie // We are barbairans
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 = {
#		OR = {
#			original_tag = SAU
#			original_tag = SAF
#		}
#		democratic > 0.5
#		date > 1940.1.1
		NOT = { has_country_flag = we_r_barbarians }
		has_idea = barbarian
	}

#	fire_only_once = yes
	
	mean_time_to_happen = {
		days = 1
	}
	
	option = {
		name = usa.7.a
		ai_chance = {
			factor = 75
		}
		set_rule = { can_send_volunteers = no }
		set_rule = { can_puppet = no }
		set_rule = { can_force_government = no }
		set_rule = { can_join_factions = no }
		set_country_flag = we_r_barbarians
	}
}

# Gorila Tribe number one
country_event = {
	id = usa.8
	title = usa.3.t
	desc = usa.3.d
	picture = GFX_report_event_usa_pearl_harbor_airphoto

	fire_only_once = yes

	trigger = {
		tag = MZB
		NOT = { country_exists = BOT }
		NOT = { country_exists = ETH }
		NOT = { country_exists = ZIM }
		NOT = { country_exists = COG }
	}

	mean_time_to_happen = {
		days = 7
	}
	
	option = {
		name = usa.3.a
		add_stability = 0.1
		add_war_support = 0.05

		set_rule = { can_puppet = yes }
		set_rule = { can_join_factions = yes }
		set_rule = { can_not_declare_war = no }
		set_rule = { can_join_factions = yes }
	}
}

# Bat Tribe Number one
country_event = {
	id = usa.9
	title = usa.3.t
	desc = usa.3.d
	picture = GFX_report_event_usa_pearl_harbor_airphoto

	fire_only_once = yes

	trigger = {
		tag = ZIM
		NOT = { country_exists = BOT }
		NOT = { country_exists = ETH }
		NOT = { country_exists = MZB }
		NOT = { country_exists = COG }
	}

	mean_time_to_happen = {
		days = 7
	}
	
	option = {
		name = usa.3.a
		add_stability = 0.1
		add_war_support = 0.05

		set_rule = { can_puppet = yes }
		set_rule = { can_join_factions = yes }
		set_rule = { can_not_declare_war = no }
		set_rule = { can_join_factions = yes }
	}
}

# Lemur tribe number one
country_event = {
	id = usa.10
	title = usa.3.t
	desc = usa.3.d
	picture = GFX_report_event_usa_pearl_harbor_airphoto

	fire_only_once = yes

	trigger = {
		tag = COG
		NOT = { country_exists = BOT }
		NOT = { country_exists = ETH }
		NOT = { country_exists = ZIM }
		NOT = { country_exists = MZB }
	}

	mean_time_to_happen = {
		days = 7
	}
	
	option = {
		name = usa.3.a
		add_stability = 0.1
		add_war_support = 0.05

		set_rule = { can_puppet = yes }
		set_rule = { can_join_factions = yes }
		set_rule = { can_not_declare_war = no }
		set_rule = { can_join_factions = yes }
	}
}

# 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

	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
	}

	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 }
		create_country_leader = {
			name = "Douglas MacArthur"
			desc = "POLITICS_DOUGLAS_MACARTHUR_DESC"
			picture = "Portrait_USA_Douglas_MacArthur.dds"
			expire = "1965.1.1"
			ideology = conservatism
			traits = {
				
			}
		}
		remove_unit_leader = 57
	}
}

# 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 // Sothori Intro
country_event = {
	id = usa.13
	title = usa.13.t
	desc = usa.13.d
	picture = GFX_report_event_usa_funeral

	trigger = {
		original_tag = SAF
#		date > 1936.01.1
	}

#	hidden = yes

	fire_only_once = yes

	mean_time_to_happen = {
		days = 1
	}

	option = { 
		name = usa.13.a
		hidden_effect = {
			BOT = {	country_event = { id = usa.14 } }
			COG = {	country_event = { id = usa.14 } }
			ETH = {	country_event = { id = usa.14 } }
			MZB = {	country_event = { id = usa.14 } }
			ZIM = {	country_event = { id = usa.14 } }
		}
	}
}

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

	is_triggered_only = yes
	
	option = { 
		name = usa.14.a
		Root = { 
			set_rule = { can_not_declare_war = yes }
			set_rule = { can_send_volunteers = no }
			set_rule = { can_puppet = no }
			set_rule = { can_force_government = no }
			set_rule = { can_join_factions = no }
		}


#		add_opinion_modifier = { target = GER modifier = unholy_alliance }
	}
}

#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 = 0.5
		}
		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 }
	}
}