war_measures = {

	USA_homeland_defense = {

		icon = generic_prepare_civil_war

		allowed = {
			original_tag = USA
		}

		available = {
			any_state = {
				is_core_of = USA
				NOT = {
					is_controlled_by = USA
				}
			}
			has_civil_war = no

		}

		cost = 50
		fire_only_once = yes
		ai_will_do = {
			factor = 200
		}

		visible = {
			has_defensive_war = yes
			CSA = {
				exists = no
			}
		}

		complete_effect = {
			if = {
				limit = {
					has_war_support < 0.9
				}
				set_war_support = 0.9
			}
			if = {
				limit = {
					has_idea = great_depression
				}
				remove_ideas = great_depression
			}
			if = {
				limit = {
					NOT = {
						OR = {
							has_idea = extensive_conscription
							has_idea = scraping_the_barrel
							has_idea = service_by_requirement
							has_idea = all_adults_serve
						}
					}
				}
				add_ideas = extensive_conscription
			}
			if = {
				limit = {
					OR = {
						has_idea = undisturbed_isolation
						has_idea = isolation
						has_idea = civilian_economy
						has_idea = low_economic_mobilisation
					}
				}
				add_ideas = war_economy
			}
			add_ideas = USA_homeland_defense
		}
	}
}

USA_aid_britain = {
	USA_establish_personal_communication_with_former_naval_person = {

		icon = generic_political_discourse

		allowed = {
			original_tag = USA
		}

		available = {
			has_country_leader = { ruling_only = yes character = USA_franklin_delano_roosevelt }
			has_country_flag = blood_toil_tears_sweat_speech
			ENG = { has_defensive_war = yes }
		}

		cost = 50
		fire_only_once = yes
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 10
				has_opinion = { target = ENG value > 60 }
			}
			modifier = {
				factor = 10
				has_opinion = { target = ENG value > 99 }
			}
		}

		visible = {
			has_war = no
		}

		complete_effect = {
			add_war_support = 0.05
			add_opinion_modifier = { target = ENG modifier = USA_special_relationship }
			reverse_add_opinion_modifier = { target = ENG modifier = USA_special_relationship }
		}
	}

	USA_battle_domestic_isolationism = {

		icon = generic_civil_support

		allowed = {
			original_tag = USA
		}

		available = {
			has_country_leader = { ruling_only = yes character = USA_franklin_delano_roosevelt }
			has_country_flag = fight_on_the_beaches_speech
			ENG = { has_defensive_war = yes }
		}

		cost = 50
		fire_only_once = yes
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 10
				has_opinion = { target = ENG value > 60 }
			}
			modifier = {
				factor = 10
				has_opinion = { target = ENG value > 99 }
			}
		}

		modifier = {
			war_support_weekly = 0.002		
		}

		days_remove = 180

		visible = {
			has_war = no
		}

		complete_effect = {
			add_war_support = 0.05
		}
	}

	USA_emergency_arms_deliveries = {

		icon = generic_prepare_civil_war

		allowed = {
			original_tag = USA
		}

		available = {
			has_country_leader = { ruling_only = yes character = USA_franklin_delano_roosevelt }
			has_country_flag = this_was_their_finest_hour_speech
			ENG = { has_defensive_war = yes }
		}

		cost = 50
		fire_only_once = yes
		ai_will_do = {
			factor = 1
			modifier = {
				factor = 10
				has_opinion = { target = ENG value > 60 }
			}
			modifier = {
				factor = 10
				has_opinion = { target = ENG value > 99 }
			}
		}

		modifier = {
			war_support_weekly = 0.005		
		}

		days_remove = 30

		visible = {
			has_war = no
		}

		complete_effect = {
			ENG = {
				add_equipment_to_stockpile = { type = infantry_equipment_0 amount = 20000 producer = USA }
				add_equipment_to_stockpile = { type = artillery_equipment_1 amount = 300 producer = USA }
				add_equipment_to_stockpile = { type = support_equipment_1 amount = 300 producer = USA }
				country_event = { id = wtt_britain.30 }
			}
		}
	}

	USA_arsenal_of_democracy_decision = {

		icon = generic_industry

		allowed = {
			original_tag = USA
		}

		available = {
			has_country_leader = { ruling_only = yes character = USA_franklin_delano_roosevelt }
			has_country_flag = mers_el_kebir_raid
			ENG = { has_defensive_war = yes }
		}

		cost = 50
		fire_only_once = yes
		ai_will_do = {
			factor = 10
		}

		visible = {
			has_war = no
		}

		modifier = {
			war_support_weekly = 0.001		
			industrial_capacity_factory = 0.02
			industrial_capacity_dockyard = 0.02
			consumer_goods_factor = -0.15
		}

		days_remove = 360

		complete_effect = {
		}
	}
}

USA_war_plans = {
	USA_execute_war_plan_silver = {
		icon = generic_operation
		available = {
			has_war_with = ITA
		}
		visible = {
			has_completed_focus = USA_war_plan_silver
		}
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		days_remove = 180
		targeted_modifier = {
			tag = ITA
			attack_bonus_against = 0.1
			defense_bonus_against = 0.1
		}
	}
	USA_execute_war_plan_orange = {
		icon = generic_operation
		available = {
			has_war_with = JAP
		}
		visible = {
			has_completed_focus = USA_war_plan_orange
		}
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		days_remove = 180
		modifier = {
			amphibious_invasion = 0.1
			invasion_preparation = -0.25
		}
		targeted_modifier = {
			tag = JAP
			attack_bonus_against = 0.1
			defense_bonus_against = 0.1
		}
		targeted_modifier = {
			tag = MAN
			attack_bonus_against = 0.1
			defense_bonus_against = 0.1
		}
		targeted_modifier = {
			tag = MEN
			attack_bonus_against = 0.1
			defense_bonus_against = 0.1
		}
	}
	USA_execute_war_plan_black = {
		icon = generic_operation
		available = {
			has_war_with = GER
		}
		visible = {
			has_completed_focus = USA_war_plan_black
		}
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		days_remove = 180
		targeted_modifier = {
			tag = GER
			attack_bonus_against = 0.1
			defense_bonus_against = 0.1
		}
	}
	USA_execute_war_plan_white = {
		icon = generic_operation
		available = {
			has_war_with = SOU
		}
		visible = {
			has_completed_focus = USA_war_plan_white
		}
		ai_will_do = {
			factor = 1
		}
		fire_only_once = yes
		days_remove = 180
		targeted_modifier = {
			tag = SOU
			attack_bonus_against = 0.1
			defense_bonus_against = 0.1
		}
	}
}

operations = {

	USA_initiate_the_greenland_patrol = {

		icon = generic_operation
	
		allowed = {
			tag = USA
		}
		
		available = {
			OR = {
				has_government = democratic
				has_government = neutrality
			}
			101 = {
				is_owned_and_controlled_by = DEN
			}
			DEN = {
				is_subject = yes
			}
			IF = {
				limit = {	
					DEN = {
						is_subject = yes
					}
				}
				DEN = {
					overlord = {
						NOT = {
							has_government = democratic
							has_war_with = USA #Unfair to just grab a piece of land from your enemy like this
							is_in_faction_with = ROOT
						}
					}
				}
			}
		}

		cost = 50

		fire_only_once = yes

		ai_will_do = {
			base = 1
			modifier = {
				factor = 50 
				DEN = {
					overlord = {
						OR = {
							has_government = fascism
							has_government = communism
						}
					}
				}
			}
			modifier = {
				factor = 2
				is_historical_focus_on = yes
				ENG = {
					has_war_with = GER
					has_subject = CAN
				}	
				GER = {
					has_government = fascism
					has_subject = DEN
				}
			}
		} 
		
		visible = {
			tag = USA
			OR = {
				has_government = democratic
				has_government = neutrality
			}
			101 = {
				is_owned_and_controlled_by = DEN
			}
			DEN = {
				is_subject = yes
				overlord = {
					is_major = yes
					NOT = {
						has_government = democratic
						has_war_with = USA #Unfair to just grab a piece of land from your enemy like this
						is_in_faction_with = ROOT
					}
				}
			}
			has_dlc = "Arms Against Tyranny"
		}
		
		complete_effect = {
			DEN = { country_event = { id = AAT_USA_events.01 days = 2 } }
			add_ideas = USA_greenland_patrol_idea
			ROOT = {
				transfer_state = 101
			}
			hidden_effect = {
				set_global_flag = USA_occupied_DEN_greenland
			}
		}
	}
}
