protect_poland_against_germany = {
	allowed = { original_tag = ENG }

	enable = {
		GER = { has_completed_focus = GER_fate_of_czechoslovakia }
		GER = { NOT = { has_war_with = POL } }
		country_exists = POL
	}
	abort = {
		OR = {
			NOT = { country_exists = POL }
			has_war_with = POL
		}
	}

	ai_strategy = {
		type = protect
		id = "POL"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "POL"
		value = 200
	}
	ai_strategy = {
		type = diplo_action_desire
		id = POL
		target = guarantee
		value = 20
	}
}

ENG_trade_with_poland = {
	# Poland has a mirrored version of this
	allowed = {
		original_tag = ENG
	}
	enable = {
		OR = {
			POL = { has_government = neutrality }
			POL = { has_government = democratic }
		}
		has_government = democratic
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_market_trade_desire
		id = POL
		value = 60
	}
}

ENG_less_weapon_purchases_more_for_construction = {
	allowed = {
		original_tag = ENG
	}
	enable = {
		date < 1939.1.1
		has_war = no
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_market_spend_factories
		value = -80  # 80 % less factories
	}
	ai_strategy = {  # Don't even try buying infantry equipment too early
		type = equipment_market_buying_threshold
		id = infantry_equipment
		value = -20000  # Absolute number of units
	}
}

ENG_fewer_factories_for_purchases_please = {
	allowed = {
		original_tag = ENG
	}
	enable = {
		date > 1939.1.1
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = equipment_market_spend_factories
		value = -50  # 50 % less factories
	}
}

ENG_protect_poland_against_germany_even_more = {
	allowed = { original_tag = ENG }
	enable = {
		GER = { has_completed_focus = GER_fate_of_czechoslovakia }
		GER = { NOT = { has_war_with = POL } }
		country_exists = POL
	}
	abort = {
		NOT = { country_exists = POL }
	}

	ai_strategy = {
		type = protect
		id = "POL"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "POL"
		value = 200
	}
}

ENG_defend_poland_against_germany = {
	allowed = { original_tag = ENG }
	enable = {
		GER = { has_war_with = POL }
		country_exists = POL
	}
	abort = {
		OR = {
			NOT = { country_exists = POL }
			has_war_with = POL
		}
	}

	ai_strategy = {
		type = befriend
		id = "POL"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "POL"
		value = 200
	}
}

ENG_gang_up_GER_with_USA = {
	allowed = { original_tag = ENG }
	enable = {
		FRA = {
			OR = {
				has_capitulated = yes
				exists = no
			}
		}
	}
	abort_when_not_enabled = yes

	# after FRA falls, both ENG and USA will try to help in europe and africa
	ai_strategy = {
		type = force_defend_ally_borders
		value = 100
		target = europe
	}
	ai_strategy = {
		type = force_defend_ally_borders
		value = 100
		target = africa
	}
}

ENG_accept_USA_access = {
	allowed = {
		original_tag = ENG
	}
	enable = {
		tag = ENG
		date > 1940.9.9
		USA = {
			is_ai = yes
			NOT = {
				OR = {
					is_in_faction_with = ENG
					has_military_access_to = ENG
				}
			}
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = diplo_action_acceptance
		id = USA
		target = military_access
		value = 1000
	}
}

ENG_allies_dont_ask_for_diplo_access_to_SOV = {
	enable = {
		ENG = {
			has_government = democratic
		}
		SOV = {
			has_government = communism
		}
		is_in_faction_with = ENG
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = diplo_action_desire
		id = SOV
		target = military_access
		value = -5000
	}
	ai_strategy = {
		type = diplo_action_desire
		id = TAN
		target = military_access
		value = -5000
	}
	ai_strategy = {
		type = diplo_action_desire
		id = MON
		target = military_access
		value = -5000
	}
	ai_strategy = {
		type = diplo_action_desire
		id = SOV
		target = docking_rights
		value = -5000
	}
	ai_strategy = {
		type = diplo_action_desire
		id = TAN
		target = docking_rights
		value = -5000
	}
	ai_strategy = {
		type = diplo_action_desire
		id = MON
		target = docking_rights
		value = -5000
	}
}

ENG_dont_kick_russia_out_from_triple_entente_due_to_gobbling_up_breakaway_states = {
	allowed = {
		original_tag = ENG
	}

	enable = {
		is_in_faction_with = SOV
		SOV = { has_completed_focus = SOV_the_triple_entente }
	}

	abort = {
		NOT = { is_in_faction_with = SOV }
	}

	ai_strategy = {
		type =  alliance
		id = SOV
		value = 200
	}

	ai_strategy = {
		type =  befriend
		id = SOV
		value = 200
	}
}

ENG_the_baltic_is_a_terrible_holiday_destination = {

	allowed = {
		original_tag = ENG
	}

	enable = {
		OR = {
			has_war_with = GER
			has_war_with = DEN
			GER = {
				OR = {
					has_war_with = POL
					has_war_with = HOL
					has_war_with = DEN
				}
			}
		}
	}

	abort = {
		GER = { has_war = no }
	}

	ai_strategy = {
		type = naval_avoid_region
		id = 9 #northern baltic
		value = 200
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 206 #central baltic
		value = 200
	}
	ai_strategy = {
		type = naval_avoid_region
		id = 207 #danish belts
		value = 200
	}
	#ai_strategy = {
	#	type = naval_avoid_region
	#	id = 279 #Bothnia
	#	value = 200
	#}
	ai_strategy = {
		type = naval_avoid_region
		id = 9 #gulf of finland
		value = 200
	}
}

ENG_raids = {
	allowed = {
		original_tag = ENG
	}
    enable = { always = yes }
    abort_when_not_enabled = yes
    ai_strategy = {
        type = raid_target_country
        id = GER
        value = 200 # +200% more likely to target GER
    }
}

ENG_i_like_raj = {

	allowed = {	
		original_tag = ENG 
		has_dlc = "Graveyard of Empires"
	}
	enable = {
		has_government = democratic
		RAJ = {
			has_completed_focus = RAJ_tryst_with_destiny	
		}
	}
	abort_when_not_enabled = yes

	ai_strategy = {
		type = befriend
		id = "RAJ"
		value = 200
	}
	ai_strategy = {
		type = alliance
		id = "RAJ"
		value = 200
	}
}

ENG_become_head_of_crypto = {
	allowed = {	
		original_tag = ENG 
		has_dlc = "No Compromise, No Surrender"
		has_dlc = "La Resistance"
	}
	enable = {
		has_done_agency_upgrade  = upgrade_form_department
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = become_head_of_crypto
		value = 8
	}
}

ENG_become_supreme_commander = {
	allowed = {	
		original_tag = ENG 
		has_dlc = "No Compromise, No Surrender"
	}
	enable = {
		date > 1938.1.1
		date < 1940.1.1 
	}
	abort_when_not_enabled = yes
	ai_strategy = {
		type = spent_faction_initiative_priority
		id = unlock_faction_commander
		value = 5
	}
}

ENG_dominate_the_home_islands = {
	allowed = {
		original_tag = ENG
	}
	
	enable = {
		has_war_with = JAP
		date > 1943.8.1
		NOT = { has_war_with = GER }
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = naval_dominance
		id = home_islands_control_zone
		value = 100
	}
	
	ai_strategy = {
		type = naval_dominance
		id = micronesia_pacific_control_zone
		value = 80
	}
	
	ai_strategy = {
		type = naval_dominance
		id = mariana_pacific_control_zone
		value = 80
	}
	
}

ENG_develop_mediterranean_supremacy = {
	allowed = {
		original_tag = ENG
	}
	
	enable = {
		OR = {
			has_war_with = ITA
			has_war_with = SOU
		}
		date > 1940.1.1
	}
	
	abort_when_not_enabled = yes
	
	ai_strategy = {
		type = naval_dominance
		id = western_med_control_zone
		value = 30
	}
	
	ai_strategy = {
		type = naval_dominance
		id = eastern_med_control_zone
		value = 80
	}
}
