POR_overseas_provinces = {

	POR_angola_overseas_province = {

		icon = infiltrate_state

		available = {
			
			has_completed_focus = POR_luso_tropicalism
			AND = {
				POR = {
					controls_state = 540
					controls_state = 796
				}
				ANG = { exists = no }
			}
		}

		cost = 0
		fire_only_once = yes
		days_remove = 730
		ai_will_do = {
			factor = 2
		}
		modifier = {
			political_power_gain = -0.2
		}
		visible = {
			has_completed_focus = POR_luso_tropicalism
		}
		remove_effect = {
			country_event = lar_portugal_overseas_provinces.1
		}		
	}

	POR_mozambique_overseas_territory = {

		icon = infiltrate_state

		available = {
			has_completed_focus = POR_luso_tropicalism
			AND = {
				POR = {
					controls_state = 544
				}
				MZB = { exists = no }
			}
		}

		cost = 0
		fire_only_once = yes
		days_remove = 730
		ai_will_do = {
			factor = 2
		}

		modifier = {
			political_power_gain = -0.2
		}
		
		visible = {
			has_completed_focus = POR_luso_tropicalism
		}
		remove_effect = {			
			country_event = lar_portugal_overseas_provinces.2
		}
	}	
}

POR_arms_purchases = {

	POR_buy_artillery_in_britain = { 

		icon = generic_industry

		available = {
			ENG = {
				has_opinion = {
					target = ROOT
					value > 0
				}
			}
		}

		cost = 0
		days_remove = 90
		days_re_enable = 90
		ai_will_do = {
			factor = 0.1
			modifier = {
				OR = {
					num_of_civilian_factories < 5
					stockpile_ratio = { 
		  				archetype = artillery_equipment
		  				ratio > 3
		  			}
				}
				factor = 0
			}
			modifier = {
				has_war = yes
				factor = 10
			}
		}
		modifier = {
			civilian_factory_use = 1
		}
		visible = {
			has_completed_focus = POR_british_guns
			NOT = {
				has_war_with = ENG
			}
			country_exists = ENG
		}
		complete_effect = {
			ENG = {
				add_offsite_building = {
					type = industrial_complex
					level = 1
				}
				add_opinion_modifier = {
					target = POR
					modifier = POR_bought_guns
				}

			}
			add_opinion_modifier = {
				target = ENG
				modifier = POR_sold_guns
			}
			add_opinion_modifier = {
				target = ENG
				modifier = POR_arms_trade
			}
		}
		remove_effect = {
			add_equipment_to_stockpile = {
				type = artillery_equipment
				amount = 100
				producer = ENG
			}
			ENG = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
			}
		}
	}
	POR_buy_aa_in_britain = { 

		icon = generic_industry

		available = {
			ENG = {
				has_opinion = {
					target = ROOT
					value > 0
				}
				has_tech = interwar_antiair
			}
		}

		cost = 0
		days_remove = 90
		days_re_enable = 90
		ai_will_do = {
			factor = 0.1
			modifier = {
				OR = {
					num_of_civilian_factories < 5
					stockpile_ratio = { 
		  				archetype = anti_air_equipment
		  				ratio > 3
		  			}
				}
				factor = 0
			}
			modifier = {
				has_war = yes
				factor = 10
			}
		}
		modifier = {
			civilian_factory_use = 1
		}
		visible = {
			has_completed_focus = POR_british_guns
			NOT = {
				has_war_with = ENG
			}
			country_exists = ENG
		}
		complete_effect = {
			ENG = {
				add_offsite_building = {
					type = industrial_complex
					level = 1
				}
				add_opinion_modifier = {
					target = POR
					modifier = POR_bought_guns
				}
			}
			add_opinion_modifier = {
				target = ENG
				modifier = POR_sold_guns
			}
			add_opinion_modifier = {
				target = ENG
				modifier = POR_arms_trade
			}
		}
		remove_effect = {
			add_equipment_to_stockpile = {
				type = anti_air_equipment
				amount = 100
				producer = ENG
			}
			ENG = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
			}
		}
	}

	POR_buy_at_in_britain = { 

		icon = generic_industry

		available = {
			ENG = {
				has_opinion = {
					target = ROOT
					value > 0
				}
				has_tech = interwar_antitank
			}
		}

		cost = 0
		days_remove = 90
		days_re_enable = 90
		ai_will_do = {
			factor = 0.1
			modifier = {
				OR = {
					num_of_civilian_factories < 5
					stockpile_ratio = { 
		  				archetype = anti_tank_equipment
		  				ratio > 3
		  			}
				}
				factor = 0
			}
			modifier = {
				has_war = yes
				factor = 10
			}
		}
		modifier = {
			civilian_factory_use = 1
		}
		visible = {
			has_completed_focus = POR_british_guns
			NOT = {
				has_war_with = ENG
			}
			country_exists = ENG
		}
		complete_effect = {
			ENG = {
				add_offsite_building = {
					type = industrial_complex
					level = 1
				}
				add_opinion_modifier = {
					target = POR
					modifier = POR_bought_guns
				}
			}
			add_opinion_modifier = {
				target = ENG
				modifier = POR_sold_guns
			}
			add_opinion_modifier = {
				target = ENG
				modifier = POR_arms_trade
			}
		}
		remove_effect = {
			add_equipment_to_stockpile = {
				type = anti_tank_equipment
				amount = 100
				producer = ENG
			}
			ENG = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
			}
		}
	}

	POR_buy_ships_britain = {

		icon = eng_trade_unions_support

		available = {
			ENG = {
				has_war = no
				has_opinion = {
					target = ROOT
					value > 0
				}
			}
		}

		cost = 0

		ai_will_do = {
			base = 50
			modifier = {
				factor = 100
				OR = {
					ENG = { has_government = ROOT }
					AND = {
						NOT = { ENG = { has_government = fascism } }
						NOT = { has_government = fascism }
					}
				}
			}
		}
		
		visible = {
			has_completed_focus = POR_second_navy_reequipment
			ENG = {
				exists = yes
				NOT = { has_war_with = ROOT }
				has_civil_war = no
				has_capitulated = no
				owns_state = 126 #Owns London
			}
			NOT = {	has_country_flag = POR_ships_purchase_in_progress_flag }
			NOT = { has_country_flag = POR_british_ships_purchase_rejected_flag }
		}
		complete_effect = {
			ENG = {
				country_event = { id = lar_portugal_purchase_ships.1 }
			}
			set_country_flag = POR_ships_purchase_in_progress_flag
		}
	}

	POR_buy_ships_italy = {

		icon = eng_trade_unions_support

		available = {
			ITA = {
				has_war = no
				has_opinion = {
					target = ROOT
					value > 0
				}
			}
		}

		cost = 0

		ai_will_do = {
			base = 50
			modifier = {
				factor = 100
				ITA = { has_government = ROOT }
			}
		}
		
		visible = {
			has_completed_focus = POR_second_navy_reequipment
			ITA = {
				exists = yes
				NOT = { has_war_with = ROOT }
				has_civil_war = no
				has_capitulated = no
				owns_state = 2 #Owns Rome
			}
			NOT = { has_country_flag = POR_ships_purchase_in_progress_flag }
			NOT = { has_country_flag = POR_british_ships_purchase_rejected_flag }
		}
		complete_effect = {
			ITA = {
				country_event = { id = lar_portugal_purchase_ships.1 }
			}
			set_country_flag = POR_ships_purchase_in_progress_flag
		}
	}

	#Mission to track the progress of British SUBMARINES construction
	POR_british_submarines_construction_progress = {
		
		icon = generic_naval

		allowed = {
			original_tag = POR
		}

		visible = {
			has_country_flag = POR_purchase_british_submarines_flag
			has_dlc = "Man the Guns"
		}

		modifier = {
			civilian_factory_use = 1
		}

		days_remove = 365

		cancel_trigger = {
			OR = {
				NOT = { country_exists = POR }
				NOT = { country_exists = ENG }
				ENG = {
					OR = {
						has_war_with = ROOT
						has_civil_war = yes
						has_capitulated = yes
						NOT = { owns_state = 126 } #Owns London
					}
				}
			}
		}

		#On Activation
		complete_effect ={
			ENG = {
				add_offsite_building = {
					type = industrial_complex
					level = 1
				}
			}
		}

		#Fail
		cancel_effect = {
			ENG = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
				remove_opinion_modifier = {
					target = POR
					modifier = POR_bought_ships
				}
			}
			remove_opinion_modifier = {
				target = ENG
				modifier = POR_sold_ships
			}
			remove_opinion_modifier = {
				target = ENG
				modifier = POR_ships_trade
			}			
			clr_country_flag = POR_purchase_british_submarines_flag
			clr_country_flag = POR_ships_purchase_in_progress_flag
		}

		#Success
		remove_effect = {
			hidden_effect = { add_manpower = 600 }
			if = {
				limit = { has_dlc = "Man the Guns" }
				if = { 
					limit = {
						ENG = { has_tech = advanced_ship_hull_submarine }
					}
					ENG = {
						create_equipment_variant = {
							name = "Delfim II Class"				
							type = nrm_ship_hull_submarine_4
							name_group = POR_SS_HISTORICAL
							parent_version = 0
							role_icon_index = 6
							modules = {
								fixed_ship_sub_hull_slot = nrm_submarine_hull_4
								fixed_ship_engine_slot = nrm_submarine_engine_D1_25
								fixed_ship_sonar_slot = nrm_submarine_sonar_3
								fixed_ship_noise_slot = nrm_submarine_noise_2
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_3
								fixed_ship_range_slot = nrm_range_submarine_2
								fixed_ship_radar_slot = empty
								fixed_ship_battery_slot = nrm_submarine_deckgun_4
								fixed_ship_anti_air_slot = empty
								fixed_ship_torpedo_slot = nrm_submarine_TRP_21_2_x4
								fixed_ship_torpedo_2_slot = nrm_submarine_TRP_21_2_x2
								custom_slot_1 = empty
								custom_slot_2 = empty
							}
						}
					}
					create_ship = { type = nrm_ship_hull_submarine_4 equipment_variant = "Delfim II Class" creator = ENG }
					create_ship = { type = nrm_ship_hull_submarine_4 equipment_variant = "Delfim II Class" creator = ENG }
					create_ship = { type = nrm_ship_hull_submarine_4 equipment_variant = "Delfim II Class" creator = ENG }
				}
				else_if = { 
					limit = {
						ENG = { has_tech = improved_ship_hull_submarine }
					}
					ENG = {
						create_equipment_variant = {
							name = "Delfim II Class"				
							type = nrm_ship_hull_submarine_3
							name_group = POR_SS_HISTORICAL
							parent_version = 0
							role_icon_index = 6
							modules = {
								fixed_ship_sub_hull_slot = nrm_submarine_hull_3
								fixed_ship_engine_slot = nrm_submarine_engine_D1_25
								fixed_ship_sonar_slot = nrm_submarine_sonar_3
								fixed_ship_noise_slot = nrm_submarine_noise_1
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_3
								fixed_ship_range_slot = nrm_range_submarine_2
								fixed_ship_radar_slot = empty
								fixed_ship_battery_slot = nrm_submarine_deckgun_4
								fixed_ship_anti_air_slot = empty
								fixed_ship_torpedo_slot = nrm_submarine_TRP_21_2_x4
								fixed_ship_torpedo_2_slot = nrm_submarine_TRP_21_2_x2
								custom_slot_1 = empty
								custom_slot_2 = empty
							}
						}
					}
					create_ship = { type = nrm_ship_hull_submarine_3 equipment_variant = "Delfim II Class" creator = ENG }
					create_ship = { type = nrm_ship_hull_submarine_3 equipment_variant = "Delfim II Class" creator = ENG }
					create_ship = { type = nrm_ship_hull_submarine_3 equipment_variant = "Delfim II Class" creator = ENG }
				}
				else = {
					ENG = {
						create_equipment_variant = {
							name = "Delfim II Class"				
							type = nrm_ship_hull_submarine_2
							name_group = POR_SS_HISTORICAL
							parent_version = 0
							role_icon_index = 6
							modules = {
								fixed_ship_sub_hull_slot = nrm_submarine_hull_2
								fixed_ship_engine_slot = nrm_submarine_engine_D1_25
								fixed_ship_sonar_slot = nrm_submarine_sonar_3
								fixed_ship_noise_slot = nrm_submarine_noise_0
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_3
								fixed_ship_range_slot = nrm_range_submarine_2
								fixed_ship_radar_slot = empty
								fixed_ship_battery_slot = nrm_submarine_deckgun_4
								fixed_ship_anti_air_slot = empty
								fixed_ship_torpedo_slot = nrm_submarine_TRP_21_2_x4
								fixed_ship_torpedo_2_slot = nrm_submarine_TRP_21_2_x2
								custom_slot_1 = empty
								custom_slot_2 = empty
							}
						}
					}
					create_ship = { type = nrm_ship_hull_submarine_2 equipment_variant = "Delfim II Class" creator = ENG }
					create_ship = { type = nrm_ship_hull_submarine_2 equipment_variant = "Delfim II Class" creator = ENG }
					create_ship = { type = nrm_ship_hull_submarine_2 equipment_variant = "Delfim II Class" creator = ENG }
				}
			}

			ENG = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
			}
			country_event = lar_portugal_purchase_ships.4
			set_country_flag = POR_ships_purchased_flag
			clr_country_flag = POR_purchase_british_submarines_flag
			clr_country_flag = POR_ships_purchase_in_progress_flag
		}
	}

	#Mission to track the progress of Italian SUBMARINES construction
	POR_italian_submarines_construction_progress = {
		
		icon = generic_naval

		allowed = {
			original_tag = POR
		}

		visible = {
			has_country_flag = POR_purchase_italian_submarines_flag
			has_dlc = "Man the Guns"
		}

		modifier = {
			civilian_factory_use = 1
		}

		days_remove = 365

		cancel_trigger = {
			OR = {
				NOT = { country_exists = POR }
				NOT = { country_exists = ITA }
				ITA = {
					OR = {
						has_war_with = ROOT
						has_civil_war = yes
						has_capitulated = yes
						NOT = { owns_state = 2 } #Owns Rome
					}
				}
			}	
		}


		#On Activation
		complete_effect = {
			ITA = {
				add_offsite_building = {
					type = industrial_complex
					level = 1
				}
			}
		}

		#Fail
		cancel_effect = {
			ITA = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
				remove_opinion_modifier = {
					target = POR
					modifier = POR_bought_ships
				}
			}
			remove_opinion_modifier = {
				target = ITA
				modifier = POR_sold_ships
			}
			remove_opinion_modifier = {
				target = ITA
				modifier = POR_ships_trade
			}			
			clr_country_flag = POR_purchase_italian_submarines_flag
			clr_country_flag = POR_ships_purchase_in_progress_flag
		}

		#Success
		remove_effect = {
			hidden_effect = { add_manpower = 600 }
			if = {
				limit = { has_dlc = "Man the Guns" }
				if = { 
					limit = {
						ITA = { has_tech = advanced_ship_hull_submarine }
					}
					ITA = {
						create_equipment_variant = {
							name = "Delfim II Class"				
							type = nrm_ship_hull_submarine_4
							name_group = POR_SS_HISTORICAL
							parent_version = 0
							role_icon_index = 6
							modules = {
								fixed_ship_sub_hull_slot = nrm_submarine_hull_4
								fixed_ship_engine_slot = nrm_submarine_engine_D1_40
								fixed_ship_sonar_slot = nrm_submarine_sonar_2
								fixed_ship_noise_slot = nrm_submarine_noise_2
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_2
								fixed_ship_range_slot = nrm_range_submarine_2
								fixed_ship_radar_slot = empty
								fixed_ship_battery_slot = nrm_submarine_deckgun_4
								fixed_ship_anti_air_slot = empty
								fixed_ship_torpedo_slot = nrm_submarine_TRP_21_2_x4
								fixed_ship_torpedo_2_slot = nrm_submarine_TRP_21_2_x2
								custom_slot_1 = empty
								custom_slot_2 = empty
							}
						}
					}
					create_ship = { type = nrm_ship_hull_submarine_4 equipment_variant = "Delfim II Class" creator = ITA }
					create_ship = { type = nrm_ship_hull_submarine_4 equipment_variant = "Delfim II Class" creator = ITA }
					create_ship = { type = nrm_ship_hull_submarine_4 equipment_variant = "Delfim II Class" creator = ITA }
				}
				else_if = { 
					limit = {
						ITA = { has_tech = improved_ship_hull_submarine }
					}
					ITA = {
						create_equipment_variant = {
							name = "Delfim II Class"				
							type = nrm_ship_hull_submarine_3
							name_group = POR_SS_HISTORICAL
							parent_version = 0
							role_icon_index = 6
							modules = {
								fixed_ship_sub_hull_slot = nrm_submarine_hull_3
								fixed_ship_engine_slot = nrm_submarine_engine_D1_40
								fixed_ship_sonar_slot = nrm_submarine_sonar_2
								fixed_ship_noise_slot = nrm_submarine_noise_1
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_2
								fixed_ship_range_slot = nrm_range_submarine_2
								fixed_ship_radar_slot = empty
								fixed_ship_battery_slot = nrm_submarine_deckgun_4
								fixed_ship_anti_air_slot = empty
								fixed_ship_torpedo_slot = nrm_submarine_TRP_21_2_x4
								fixed_ship_torpedo_2_slot = nrm_submarine_TRP_21_2_x2
								custom_slot_1 = empty
								custom_slot_2 = empty
							}
						}
					}
					create_ship = { type = nrm_ship_hull_submarine_3 equipment_variant = "Delfim II Class" creator = ITA }
					create_ship = { type = nrm_ship_hull_submarine_3 equipment_variant = "Delfim II Class" creator = ITA }
					create_ship = { type = nrm_ship_hull_submarine_3 equipment_variant = "Delfim II Class" creator = ITA }
				}
				else = {
					ITA = {
						create_equipment_variant = {
							name = "Delfim II Class"				
							type = nrm_ship_hull_submarine_2
							name_group = POR_SS_HISTORICAL
							parent_version = 0
							role_icon_index = 6
							modules = {
								fixed_ship_sub_hull_slot = nrm_submarine_hull_2
								fixed_ship_engine_slot = nrm_submarine_engine_D1_40
								fixed_ship_sonar_slot = nrm_submarine_sonar_2
								fixed_ship_noise_slot = nrm_submarine_noise_0
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_2
								fixed_ship_range_slot = nrm_range_submarine_2
								fixed_ship_radar_slot = empty
								fixed_ship_battery_slot = nrm_submarine_deckgun_4
								fixed_ship_anti_air_slot = empty
								fixed_ship_torpedo_slot = nrm_submarine_TRP_21_2_x4
								fixed_ship_torpedo_2_slot = nrm_submarine_TRP_21_2_x2
								custom_slot_1 = empty
								custom_slot_2 = empty
							}
						}
					}
					create_ship = { type = nrm_ship_hull_submarine_2 equipment_variant = "Delfim II Class" creator = ITA }
					create_ship = { type = nrm_ship_hull_submarine_2 equipment_variant = "Delfim II Class" creator = ITA }
					create_ship = { type = nrm_ship_hull_submarine_2 equipment_variant = "Delfim II Class" creator = ITA }
				}
			}

			ITA = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
			}
			country_event = lar_portugal_purchase_ships.4
			set_country_flag = POR_ships_purchased_flag
			clr_country_flag = POR_purchase_italian_submarines_flag
			clr_country_flag = POR_ships_purchase_in_progress_flag
		}
	}

	#Mission to track the progress of British DESTROYERS construction
	POR_british_destroyers_construction_progress = {
		
		icon = generic_naval

		allowed = {
			original_tag = POR
		}

		visible = {
			has_country_flag = POR_purchase_british_destroyers_flag
			has_dlc = "Man the Guns"
		}
		
		modifier = {
			civilian_factory_use = 1
		}

		days_remove = 365

		cancel_trigger = {
			OR = {
				NOT = { country_exists = POR }
				NOT = { country_exists = ENG }
				ENG = {
					OR = {
						has_war_with = ROOT
						has_civil_war = yes
						has_capitulated = yes
						NOT = { owns_state = 126 } #Owns London
					}
				}
			}
		}

		#On Activation
		complete_effect = {
			ENG = {
				add_offsite_building = {
					type = industrial_complex
					level = 1
				}
			}
		}

		#Fail
		cancel_effect = {
			ENG = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
				remove_opinion_modifier = {
					target = POR
					modifier = POR_bought_ships
				}
			}
			remove_opinion_modifier = {
				target = ENG
				modifier = POR_sold_ships
			}
			remove_opinion_modifier = {
				target = ENG
				modifier = POR_ships_trade
			}		
			clr_country_flag = POR_purchase_british_destroyers_flag
			clr_country_flag = POR_ships_purchase_in_progress_flag
		}

		#Success
		remove_effect = {
			if = {
				limit = { has_dlc = "Man the Guns" }
				if = { 
					limit = {
						ENG = { has_tech = improved_ship_hull_light }
					}
					hidden_effect = { add_manpower = 1000 }
					ENG = {
						create_equipment_variant = {
							name = "Vouga II Class"	
							type = nrm_ship_hull_destroyer_3
							name_group = POR_DD_HISTORICAL
							parent_version = 0
							role_icon_index = 2
							modules = {
								fixed_ship_hullform_slot = nrm_ship_hullform_destroyer_3
								fixed_ship_engine_slot = nrm_destroyer_engine_S2_050
								fixed_ship_sonar_slot = nrm_sonar_3
								fixed_ship_battery_slot = nrm_destroyer_battery_5_2_x5
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_3
								fixed_ship_range_slot = nrm_range_destroyer_2
								fixed_ship_radar_slot = empty
								fixed_ship_fire_control_system_slot = nrm_fire_control_4
								fixed_ship_fire_control_system_aa_slot = empty
								custom_slot_1 = nrm_support_destroyer_ML_1
								custom_slot_2 = nrm_support_destroyer_ASW_2
								custom_slot_3 = nrm_support_destroyer_TRP_21_C_2_x4
								custom_slot_4 = nrm_support_destroyer_TRP_21_C_2_x4
								custom_slot_5 = nrm_support_destroyer_AA_1
								custom_slot_6 = empty
							}
						}
					}
					create_ship = { type = nrm_ship_hull_destroyer_4 equipment_variant = "Vouga II Class" creator = ENG }
					create_ship = { type = nrm_ship_hull_destroyer_4 equipment_variant = "Vouga II Class" creator = ENG }
				}
				else = {
					hidden_effect = { add_manpower = 650 }
					ENG = {
						create_equipment_variant = {
							name = "Vouga II Class"	
							type = nrm_ship_hull_destroyer_2
							name_group = POR_DD_HISTORICAL
							parent_version = 0
							role_icon_index = 2
							modules = {
								fixed_ship_hullform_slot = nrm_ship_hullform_destroyer_2
								fixed_ship_engine_slot = nrm_destroyer_engine_S2_040
								fixed_ship_sonar_slot = nrm_sonar_3
								fixed_ship_battery_slot = nrm_destroyer_battery_5_2_x5
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_3
								fixed_ship_range_slot = nrm_range_destroyer_2
								fixed_ship_radar_slot = empty
								fixed_ship_fire_control_system_slot = nrm_fire_control_3
								fixed_ship_fire_control_system_aa_slot = empty
								custom_slot_1 = nrm_support_destroyer_ML_1
								custom_slot_2 = nrm_support_destroyer_ASW_2
								custom_slot_3 = nrm_support_destroyer_TRP_21_C_2_x4
								custom_slot_4 = nrm_support_destroyer_TRP_21_C_2_x4
								custom_slot_5 = nrm_support_destroyer_AA_1
								custom_slot_6 = empty
							}
						}
					}
					create_ship = { type = nrm_ship_hull_destroyer_2 equipment_variant = "Vouga II Class" creator = ENG }
					create_ship = { type = nrm_ship_hull_destroyer_2 equipment_variant = "Vouga II Class" creator = ENG }
				}
			}

			ENG = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
			}
			country_event = lar_portugal_purchase_ships.5
			set_country_flag = POR_ships_purchased_flag
			clr_country_flag = POR_purchase_british_destroyers_flag
			clr_country_flag = POR_ships_purchase_in_progress_flag
		}
	}

	#Mission to track the progress of Italian DESTROYERS construction
	POR_italian_destroyers_construction_progress = {
		
		icon = generic_naval

		allowed = {
			original_tag = POR
		}

		visible = {
			has_country_flag = POR_purchase_italian_destroyers_flag
			has_dlc = "Man the Guns"
		}

		modifier = {
			civilian_factory_use = 1
		}

		days_remove = 365

		cancel_trigger = {
			OR = {
				NOT = { country_exists = POR }
				NOT = { country_exists = ITA }
				ITA = {
					OR = {
						has_war_with = ROOT
						has_civil_war = yes
						has_capitulated = yes
						NOT = { owns_state = 2 } #Owns Rome
					}
				}
			}
		}

		#On Activation
		complete_effect ={
			ITA = {
				add_offsite_building = {
					type = industrial_complex
					level = 1
				}
			}
		}

		#Fail
		cancel_effect = {
			ITA = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
				remove_opinion_modifier = {
					target = POR
					modifier = POR_bought_ships
				}
			}
			remove_opinion_modifier = {
				target = ITA
				modifier = POR_sold_ships
			}
			remove_opinion_modifier = {
				target = ITA
				modifier = POR_ships_trade
			}		
			clr_country_flag = POR_purchase_italian_destroyers_flag
			clr_country_flag = POR_ships_purchase_in_progress_flag
		}

		is_good = yes
		#Success
		remove_effect = {
			if = {
				limit = { has_dlc = "Man the Guns" }
				if = { 
					limit = {
						ITA = { has_tech = improved_ship_hull_light }
					}
					hidden_effect = { add_manpower = 1000 }
					ITA = {
						create_equipment_variant = {
							name = "Vouga II Class"	
							type = nrm_ship_hull_destroyer_3
							name_group = POR_DD_HISTORICAL
							parent_version = 0
							role_icon_index = 2
							modules = {
								fixed_ship_hullform_slot = nrm_ship_hullform_destroyer_3
								fixed_ship_engine_slot = nrm_destroyer_engine_S2_060
								fixed_ship_sonar_slot = nrm_sonar_2
								fixed_ship_battery_slot = nrm_destroyer_battery_5_2_x6
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_2
								fixed_ship_range_slot = nrm_range_destroyer_1h
								fixed_ship_radar_slot = empty
								fixed_ship_fire_control_system_slot = nrm_fire_control_4
								fixed_ship_fire_control_system_aa_slot = empty
								custom_slot_1 = nrm_support_destroyer_ML_1
								custom_slot_2 = nrm_support_destroyer_ASW_2
								custom_slot_3 = nrm_support_destroyer_TRP_21_C_2_x4
								custom_slot_4 = nrm_support_destroyer_TRP_21_C_2_x4
								custom_slot_5 = nrm_support_destroyer_AA_1
								custom_slot_6 = empty
							}
						}
					}
					create_ship = { type = nrm_ship_hull_destroyer_4 equipment_variant = "Vouga II Class" creator = ITA }
					create_ship = { type = nrm_ship_hull_destroyer_4 equipment_variant = "Vouga II Class" creator = ITA }
				}
				else_if = { 
					limit = {
						ITA = { has_tech = improved_destroyer }
					}
					hidden_effect = { add_manpower = 800 }
					ITA = {
						create_equipment_variant = {
							name = "Vouga II Class"	
							type = nrm_ship_hull_destroyer_2
							name_group = POR_DD_HISTORICAL
							parent_version = 0
							role_icon_index = 2
							modules = {
								fixed_ship_hullform_slot = nrm_ship_hullform_destroyer_2
								fixed_ship_engine_slot = nrm_destroyer_engine_S2_050
								fixed_ship_sonar_slot = nrm_sonar_2
								fixed_ship_battery_slot = nrm_destroyer_battery_5_2_x6
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_2
								fixed_ship_range_slot = nrm_range_destroyer_1h
								fixed_ship_radar_slot = empty
								fixed_ship_fire_control_system_slot = nrm_fire_control_4
								fixed_ship_fire_control_system_aa_slot = empty
								custom_slot_1 = nrm_support_destroyer_ML_1
								custom_slot_2 = nrm_support_destroyer_ASW_2
								custom_slot_3 = nrm_support_destroyer_TRP_21_C_2_x4
								custom_slot_4 = nrm_support_destroyer_TRP_21_C_2_x4
								custom_slot_5 = nrm_support_destroyer_AA_1
								custom_slot_6 = empty
							}
						}
					}
					create_ship = { type = nrm_ship_hull_destroyer_3 equipment_variant = "Vouga II Class" creator = ITA }
					create_ship = { type = nrm_ship_hull_destroyer_3 equipment_variant = "Vouga II Class" creator = ITA }
				}
				else = {
					hidden_effect = { add_manpower = 650 }
					ITA = {
						create_equipment_variant = {
							name = "Vouga II Class"	
							type = nrm_ship_hull_destroyer_2
							name_group = POR_DD_HISTORICAL
							parent_version = 0
							modules = {
								fixed_ship_battery_slot = ship_light_battery_1
								fixed_ship_anti_air_slot = ship_anti_air_1
								fixed_ship_fire_control_system_slot = ship_fire_control_system_0
								fixed_ship_radar_slot = empty
								fixed_ship_engine_slot = light_ship_engine_2
								fixed_ship_torpedo_slot = ship_torpedo_1
								mid_1_custom_slot = ship_mine_layer_1
								rear_1_custom_slot = ship_depth_charge_1
							}
						}
					}
					create_ship = { type = nrm_ship_hull_destroyer_2 equipment_variant = "Vouga II Class" creator = ITA }
					create_ship = { type = nrm_ship_hull_destroyer_2 equipment_variant = "Vouga II Class" creator = ITA }
				}
			}

			ITA = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
			}
			country_event = lar_portugal_purchase_ships.5
			set_country_flag = POR_ships_purchased_flag
			clr_country_flag = POR_purchase_italian_destroyers_flag
			clr_country_flag = POR_ships_purchase_in_progress_flag
		}
	}

	#Mission to track the progress of British LIGHT CRUISER construction
	POR_british_light_cruiser_construction_progress = {
		
		icon = generic_naval

		allowed = {
			original_tag = POR
		}

		visible = {
			has_country_flag = POR_purchase_british_light_cruiser_flag
			has_dlc = "Man the Guns"
		}
		
		modifier = {
			civilian_factory_use = 1
		}

		days_remove = 546

		cancel_trigger = {
			OR = {
				NOT = { country_exists = POR }
				NOT = { country_exists = ENG }
				ENG = {
					OR = {
						has_war_with = ROOT
						has_civil_war = yes
						has_capitulated = yes
						NOT = { owns_state = 126 } #Owns London
					}
				}
			}
		}

		#Fail
		cancel_effect = {
			ENG = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
				remove_opinion_modifier = {
					target = POR
					modifier = POR_bought_ships
				}
			}
			remove_opinion_modifier = {
				target = ENG
				modifier = POR_sold_ships
			}
			remove_opinion_modifier = {
				target = ENG
				modifier = POR_ships_trade
			}
			clr_country_flag = POR_purchase_british_light_cruiser_flag
			clr_country_flag = POR_ships_purchase_in_progress_flag
		}

		#Success
		remove_effect = {
			if = {
				limit = { has_dlc = "Man the Guns" }
				if = { 
					limit = {
						ENG = { has_tech = advanced_ship_hull_cruiser }
					}
					hidden_effect = { add_manpower = 1400 }
					ENG = {
						create_equipment_variant = {
							name = "Atlântico Class"	
							type = nrm_ship_hull_cruiser_4
							name_group = POR_CL_HISTORICAL
							parent_version = 0
							role_icon_index = 2
							modules = {
								fixed_ship_hullform_slot = nrm_ship_hullform_cruiser_4
								fixed_ship_engine_slot = nrm_cruiser_engine_S2_075
								fixed_ship_armor_layout_slot = nrm_armour_layout_2
								fixed_ship_armor_slot = nrm_cruiser_armour_03_2
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_3
								fixed_ship_range_slot = nrm_range_cruiser_2
								fixed_ship_radar_slot = empty
								fixed_ship_fire_control_system_slot = nrm_fire_control_4
								fixed_ship_fire_control_system_aa_slot = empty
								fixed_ship_battery_slot = nrm_cruiser_battery_6_3_x09
								fixed_ship_tertiary_slot = nrm_cruiser_tertiary_HA_4_2_x12
								custom_slot_1 = empty
								custom_slot_2 = nrm_support_cruiser_TRP_21_2_x06
								custom_slot_3 = nrm_support_cruiser_FP_1
								custom_slot_4 = nrm_support_cruiser_AA_2
								custom_slot_5 = empty
								custom_slot_6 = nrm_support_cruiser_SNR_2
							}
						}
					}
					create_ship = { type = nrm_ship_hull_cruiser_4 equipment_variant = "Atlântico Class" creator = ENG }
				}
				else_if = { 
					limit = {
						ENG = { has_tech = improved_ship_hull_cruiser }
					}
					hidden_effect = { add_manpower = 1200 }
					ENG = {
						create_equipment_variant = {
							name = "Atlântico Class"	
							type = nrm_ship_hull_cruiser_3
							name_group = POR_CL_HISTORICAL
							parent_version = 0
							role_icon_index = 2
							modules = {
								fixed_ship_hullform_slot = nrm_ship_hullform_cruiser_3
								fixed_ship_engine_slot = nrm_cruiser_engine_S2_065
								fixed_ship_armor_layout_slot = nrm_armour_layout_2
								fixed_ship_armor_slot = nrm_cruiser_armour_02h_2
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_3
								fixed_ship_range_slot = nrm_range_cruiser_2
								fixed_ship_radar_slot = empty
								fixed_ship_fire_control_system_slot = nrm_fire_control_4
								fixed_ship_fire_control_system_aa_slot = empty
								fixed_ship_battery_slot = nrm_cruiser_battery_6_3_x08
								fixed_ship_tertiary_slot = nrm_cruiser_tertiary_HA_4_2_x08
								custom_slot_1 = empty
								custom_slot_2 = nrm_support_cruiser_TRP_21_2_x06
								custom_slot_3 = nrm_support_cruiser_FP_1
								custom_slot_4 = nrm_support_cruiser_AA_2
								custom_slot_5 = empty
								custom_slot_6 = nrm_support_cruiser_SNR_2
							}
						}
					}
					create_ship = { type = nrm_ship_hull_cruiser_3 equipment_variant = "Atlântico Class" creator = ENG }
				}
				else = {
					hidden_effect = { add_manpower = 800 }
					ENG = {
						create_equipment_variant = {
							name = "Atlântico Class"	
							type = nrm_ship_hull_cruiser_2
							name_group = POR_CL_HISTORICAL
							parent_version = 0
							role_icon_index = 2
							modules = {
								fixed_ship_hullform_slot = nrm_ship_hullform_cruiser_2
								fixed_ship_engine_slot = nrm_cruiser_engine_S2_060
								fixed_ship_armor_layout_slot = nrm_armour_layout_2
								fixed_ship_armor_slot = nrm_cruiser_armour_02h_2
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_3
								fixed_ship_range_slot = nrm_range_cruiser_2
								fixed_ship_radar_slot = empty
								fixed_ship_fire_control_system_slot = nrm_fire_control_4
								fixed_ship_fire_control_system_aa_slot = empty
								fixed_ship_battery_slot = nrm_cruiser_battery_6_2_x08
								fixed_ship_tertiary_slot = nrm_cruiser_tertiary_HA_4_1_x08
								custom_slot_1 = empty
								custom_slot_2 = nrm_support_cruiser_TRP_21_2_x06
								custom_slot_3 = nrm_support_cruiser_FP_1
								custom_slot_4 = nrm_support_cruiser_AA_2
								custom_slot_5 = empty
								custom_slot_6 = nrm_support_cruiser_SNR_2
							}
						}
					}
					create_ship = { type = nrm_ship_hull_cruiser_2 equipment_variant = "Atlântico Class" creator = ENG }
				}
			}

			ENG = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
			}
			country_event = lar_portugal_purchase_ships.6
			set_country_flag = POR_ships_purchased_flag
			clr_country_flag = POR_purchase_british_light_cruiser_flag
			clr_country_flag = POR_ships_purchase_in_progress_flag
		}
	}

	#Mission to track the progress of Italian LIGHT CRUISER construction
	POR_italian_light_cruiser_construction_progress = {
		
		icon = generic_naval

		allowed = {
			original_tag = POR
		}

		visible = {
			has_country_flag = POR_purchase_italian_light_cruiser_flag
			has_dlc = "Man the Guns"
		}
		
		modifier = {
			civilian_factory_use = 1
		}

		days_remove = 546

		cancel_trigger = {
			OR = {
				NOT = { country_exists = POR }
				NOT = { country_exists = ITA }
				ITA = {
					OR = {
						has_war_with = ROOT
						has_civil_war = yes
						has_capitulated = yes
						NOT = { owns_state = 2 } #Owns Rome
					}
				}
			}
		}

		#On Activation
		complete_effect ={
			ITA = {
				add_offsite_building = {
					type = industrial_complex
					level = 1
				}
			}
		}

		#Fail
		cancel_effect = {
			ITA = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
				remove_opinion_modifier = {
					target = POR
					modifier = POR_bought_ships
				}
			}
			remove_opinion_modifier = {
				target = ITA
				modifier = POR_sold_ships
			}
			remove_opinion_modifier = {
				target = ITA
				modifier = POR_ships_trade
			}
			clr_country_flag = POR_purchase_italian_light_cruiser_flag
			clr_country_flag = POR_ships_purchase_in_progress_flag
		}

		#Success
		remove_effect = {
			if = {
				limit = { has_dlc = "Man the Guns" }
				if = { 
					limit = {
						ITA = { has_tech = advanced_ship_hull_cruiser }
					}
					hidden_effect = { add_manpower = 1400 }
					ITA = {
						create_equipment_variant = {
							name = "Atlântico Class"	
							type = nrm_ship_hull_cruiser_4
							name_group = POR_CL_HISTORICAL
							parent_version = 0
							role_icon_index = 2
							modules = {
								fixed_ship_hullform_slot = nrm_ship_hullform_cruiser_4
								fixed_ship_engine_slot = nrm_cruiser_engine_S2_090
								fixed_ship_armor_layout_slot = nrm_armour_layout_2
								fixed_ship_armor_slot = nrm_cruiser_armour_03h_2
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_2
								fixed_ship_range_slot = nrm_range_cruiser_1h
								fixed_ship_radar_slot = empty
								fixed_ship_fire_control_system_slot = nrm_fire_control_3
								fixed_ship_fire_control_system_aa_slot = empty
								fixed_ship_battery_slot = nrm_cruiser_battery_6_3_x10
								fixed_ship_tertiary_slot = nrm_cruiser_tertiary_HA_4_2_x08
								custom_slot_1 = empty
								custom_slot_2 = nrm_support_cruiser_TRP_21_2_x06
								custom_slot_3 = nrm_support_cruiser_FP_1
								custom_slot_4 = nrm_support_cruiser_AA_1
								custom_slot_5 = nrm_support_cruiser_AA_1
								custom_slot_6 = empty
							}
						}
					}
					create_ship = { type = nrm_ship_hull_cruiser_4 equipment_variant = "Atlântico Class" creator = ITA }
				}
				else_if = { 
					limit = {
						ITA = { has_tech = improved_ship_hull_cruiser }
					}
					hidden_effect = { add_manpower = 1200 }
					ITA = {
						create_equipment_variant = {
							name = "Atlântico Class"	
							type = nrm_ship_hull_cruiser_3
							name_group = POR_CL_HISTORICAL
							parent_version = 0
							role_icon_index = 2
							modules = {
								fixed_ship_hullform_slot = nrm_ship_hullform_cruiser_3
								fixed_ship_engine_slot = nrm_cruiser_engine_S2_080
								fixed_ship_armor_layout_slot = nrm_armour_layout_2
								fixed_ship_armor_slot = nrm_cruiser_armour_03_2
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_2
								fixed_ship_range_slot = nrm_range_cruiser_1h
								fixed_ship_radar_slot = empty
								fixed_ship_fire_control_system_slot = nrm_fire_control_3
								fixed_ship_fire_control_system_aa_slot = empty
								fixed_ship_battery_slot = nrm_cruiser_battery_6_3_x10
								fixed_ship_tertiary_slot = nrm_cruiser_tertiary_HA_3_2_x08
								custom_slot_1 = empty
								custom_slot_2 = nrm_support_cruiser_TRP_21_2_x06
								custom_slot_3 = nrm_support_cruiser_FP_1
								custom_slot_4 = nrm_support_cruiser_AA_1
								custom_slot_5 = empty
								custom_slot_6 = empty
							}
						}
					}
					create_ship = { type = nrm_ship_hull_cruiser_3 equipment_variant = "Atlântico Class" creator = ITA }
				}
				else = {
					hidden_effect = { add_manpower = 800 }
					ITA = {
						create_equipment_variant = {
							name = "Atlântico Class"	
							type = nrm_ship_hull_cruiser_2
							name_group = POR_CL_HISTORICAL
							parent_version = 0
							role_icon_index = 2
							modules = {
								fixed_ship_hullform_slot = nrm_ship_hullform_cruiser_2
								fixed_ship_engine_slot = nrm_cruiser_engine_S2_070
								fixed_ship_armor_layout_slot = nrm_armour_layout_2
								fixed_ship_armor_slot = nrm_cruiser_armour_03_2
								fixed_ship_damagecontrol_slot = nrm_damagecontrol_2
								fixed_ship_range_slot = nrm_range_cruiser_1h
								fixed_ship_radar_slot = empty
								fixed_ship_fire_control_system_slot = nrm_fire_control_3
								fixed_ship_fire_control_system_aa_slot = empty
								fixed_ship_battery_slot = nrm_cruiser_battery_6_2_x08
								fixed_ship_tertiary_slot = nrm_cruiser_tertiary_HA_3_2_x08
								custom_slot_1 = empty
								custom_slot_2 = nrm_support_cruiser_TRP_21_2_x06
								custom_slot_3 = nrm_support_cruiser_FP_1
								custom_slot_4 = nrm_support_cruiser_AA_1
								custom_slot_5 = empty
								custom_slot_6 = empty
							}
						}
					}
					create_ship = { type = nrm_ship_hull_cruiser_2 equipment_variant = "Atlântico Class" creator = ITA }
				}
			}

			ITA = {
				add_offsite_building = {
					type = industrial_complex
					level = -1
				}
			}
			country_event = lar_portugal_purchase_ships.6
			set_country_flag = POR_ships_purchased_flag
			clr_country_flag = POR_purchase_italian_light_cruiser_flag
			clr_country_flag = POR_ships_purchase_in_progress_flag
		}
	}
}

POR_naval_blockade = {
	POR_evade_blockade_with_portuguese_convoys = {

		icon = generic_naval

		allowed = {
			NOT = { original_tag = POR }
		}

		visible = {
			POR = {
				has_completed_focus = POR_refuse_the_naval_blockade
			}
			NOT = { 
				has_country_flag = POR_evade_blockade_flag 
				has_country_flag = POR_cancel_evade_blockade_flag 
			}
		}
		
		available = {
			num_of_civilian_factories > 1
			POR = {
				has_navy_size = {
				    size > 49
				    type = convoy
				}
				has_opinion = { target = ROOT value > -10 }
			}
		}

		cost = 25
		fire_only_once = yes
		ai_will_do = {
			base = 1
		}

		cancel_trigger = {
			OR= {
				NOT = { has_war_with = ENG }
				has_war_with = POR
				has_country_flag = POR_cancel_evade_blockade_flag
				has_capitulated = yes 
			}
		}

		days_remove = -1

		modifier = {
			civilian_factory_use = 1
		}

		#Fail
		cancel_effect = {
			add_war_support = -0.1
			POR = {
				add_equipment_to_stockpile = {
		            type = convoy_1
		            amount = 50
	       		}
				add_offsite_building = { type = industrial_complex  level = -1 }
			}
		}

		#On Activation
		complete_effect = {
			add_war_support = 0.1
			set_country_flag = POR_evade_blockade_flag
			effect_tooltip = {
				POR = { 
					add_equipment_to_stockpile = {
			            type = convoy_1
			            amount = -50
		       		}
					add_offsite_building = { type = industrial_complex  level = 1 }
				}
			}
			hidden_effect=  { 
				POR = { 
					country_event = lar_portugal_naval_blockade.2 
					activate_targeted_decision = { 
						target = ROOT 
						decision = POR_portugal_cancel_blockade_evasion_for_country
					}
				}
			}
		}
	}

	POR_major_cancel_portuguese_blockade_evasion = {

		icon = generic_break_treaty

		available = {
			has_country_flag = POR_evade_blockade_flag
		}

		cost = 0
		fire_only_once = yes
		ai_will_do = {
			base = 0
			modifier = {
				add = 1
				num_of_civilian_factories < 6
			}
		}

		visible = {
			has_country_flag = POR_evade_blockade_flag
			NOT = { has_country_flag = POR_cancel_evade_blockade_flag }
		}

		complete_effect = {
			add_war_support = -0.1
			set_country_flag = POR_cancel_evade_blockade_flag
			clr_country_flag = POR_evade_blockade_flag
			POR = {
				add_offsite_building = { type = industrial_complex  level = -1 }
				add_equipment_to_stockpile = {
	                type = convoy_1
	                amount = 50
            	}
			}
		}
	}

	POR_portugal_cancel_blockade_evasion_for_country = {

		icon = generic_break_treaty

		available = {
			always = yes
		}

		cost = 0
		fire_only_once = yes
		ai_will_do = {
			base = 0
			modifier = {
				add = 1
				OR = {
					has_equipment = {
					    convoy_1 < 5
					}
					AND = {
						has_opinion = { target = FROM value < -10 }
						NOT = { has_war_with = FROM }
					}
				}
			}
		}

		visible = {
			original_tag = POR
			FROM = {
           		has_country_flag = POR_evade_blockade_flag
           		NOT = { 
           			has_country_flag = POR_cancel_evade_blockade_flag
           			has_war_with = POR
           		}
           	}
		}		

		complete_effect = {
			FROM = {
				add_war_support = -0.1
				set_country_flag = POR_cancel_evade_blockade_flag
				clr_country_flag = POR_evade_blockade_flag
			}
			add_offsite_building = { type = industrial_complex  level = -1 }
			add_equipment_to_stockpile = {
                type = convoy_1
                amount = 50
        	}
		}
	}

}

POR_iberian_summit = {
	POR_iberian_summit_pro_axis = {
		icon = eng_trade_unions_support

		available = {		
			POR = { has_war = no }
			SPA = { has_war = no }
			NOT = { has_global_flag = POR_iberian_summit_in_progress_flag }
		}

		visible = {
			tag = POR
			NOT = { has_global_flag = POR_iberian_summit_pro_axis_flag }
			POR = { 
				is_in_faction = no
				has_completed_focus = POR_iberian_summit
				NOT = { has_government = communism }
				NOT = { has_government = democratic }
			}
			country_exists = SPA
			SPA = { 
				is_in_faction = no
				OR = {
					has_completed_focus = SPA_the_phalanx_ascendant
					AND = {
						has_completed_focus = SPA_unify_the_nationalist_front
						NOT = { has_completed_focus = SPA_the_iberian_pact }
					}
				}
			}
			GER = { 
				is_faction_leader = yes 
				has_government = fascism
				has_capitulated = no
			}
		}

		cost = 50
		fire_only_once = yes
		days_remove = 1
		ai_will_do = {
			base = 0
			modifier = {
				add = 1
				has_completed_focus = POR_send_assistance
				OR = {
					GER = {
						has_war = yes 
						OR = {
							alliance_strength_ratio > 0.75
							any_war_score > 40
						}
					}
					has_opinion = { target = GER value > 0 }		
				}
			}
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}

		complete_effect = {
			set_global_flag = POR_iberian_summit_pro_axis_flag
			set_global_flag = POR_iberian_summit_in_progress_flag
			set_country_flag = POR_iberian_summit_initiator_flag
			set_variable = { global.POR_iberian_summit_target = GER } 
			set_variable = { global.POR_iberian_summit_spanish_tag = SPA }
			if = {
				limit = {
					tag = POR
				}
				SPA = { 
					country_event = { id = lar_portugal_iberian_summit.1 hours = 18 random_hours = 6 }
				}
			}
			else = {
				POR = { 
					country_event = { id = lar_portugal_iberian_summit.1 hours = 18 random_hours = 6 } 
				}
			}
		}	
	}

	POR_iberian_summit_pro_allies = {
		icon = eng_trade_unions_support

		available = {
			POR = { has_war = no }
			if = { 
				limit = { country_exists = SPD } 
				SPD = { has_war = no }
			}
			else = {
				SPA = { has_war = no }
			}
			NOT = { has_global_flag = POR_iberian_summit_in_progress_flag }
		}

		visible = {
			NOT = { has_global_flag = POR_iberian_summit_pro_allies_flag }
			POR = {
				is_in_faction = no
				has_completed_focus = POR_iberian_summit
				NOT = { has_government = fascism }
				NOT = { has_government = communism }
			}
			OR = {
				AND = {
					tag = POR
					OR = {
						AND = {
							country_exists = SPD
							SPD = {
								is_in_faction = no
								has_completed_focus = SPR_maintain_the_second_republic
								has_government = democratic
							}
						}
						AND = {
							country_exists = SPA
							SPA = {
								is_in_faction = no
								has_completed_focus = SPA_unify_the_nationalist_front
								NOT = { has_completed_focus = SPA_the_iberian_pact }
							}
						}
					}
				}
				AND = {
					tag = SPD
					is_in_faction = no
					has_completed_focus = SPR_maintain_the_second_republic
					has_government = democratic
					country_exists = POR
				}
			}
			ENG = { 
				is_faction_leader = yes 
				has_government = democratic
				has_capitulated = no
			}
		}

		cost = 50
		fire_only_once = yes
		days_remove = 1
		ai_will_do = { 
			base = 0
			modifier = {
				add = 1
				POR = {
					has_completed_focus = POR_allow_free_elections
				}					
				OR = {
					ENG = {
						has_war = yes 
						OR = {
							alliance_strength_ratio > 0.75
							any_war_score > 40
						}
					}
					has_opinion = { target = ENG value > 0 }		
				}
			}
			modifier = {
				factor = 0
				is_historical_focus_on = yes
			}
		}

		complete_effect = {
			set_global_flag = POR_iberian_summit_pro_allies_flag
			set_global_flag = POR_iberian_summit_in_progress_flag
			set_country_flag = POR_iberian_summit_initiator_flag
			set_variable = { global.POR_iberian_summit_target = ENG }
			if = {
				limit = { country_exists = SPA }
				set_variable = { global.POR_iberian_summit_spanish_tag = SPA }
			} 
			else = {
				set_variable = { global.POR_iberian_summit_spanish_tag = SPD }
			}
			if = {
				limit = { tag = POR }
				41 = {
					owner = { country_event = { id = lar_portugal_iberian_summit.5 hours = 18 random_hours = 6 } }
				}
			}
			else = {
				POR = { 
					country_event = { id = lar_portugal_iberian_summit.5 hours = 18 random_hours = 6 }
				}
			}
		}	
	}
	#Timed Decision for delaying proposal
	POR_iberian_summit_proposal_delayed = {
		icon = generic_political_discourse
		
		allowed = {
			OR = {
				tag = POR
				tag = SPD
				tag = SPA
			}
		}

		visible = {
			has_global_flag = POR_iberian_summit_proposal_delayed_flag 
		}

		fire_only_once = no

		days_remove = 180

		modifier = {
			political_power_gain = -0.2
		}

		cancel_trigger = {
			OR = {
				NOT = { country_exists = global.POR_iberian_summit_target }
				var:global.POR_iberian_summit_target = { is_faction_leader = no }
				NOT = { country_exists = POR }
				POR = {
					OR = { 
						has_war = yes 
						is_in_faction = yes
					}
				}
				NOT = { country_exists = global.POR_iberian_summit_spanish_tag }
				var:global.POR_iberian_summit_spanish_tag = {
					OR = {
						has_war = yes
						is_in_faction = yes
					}
				}
			}
		}

		#On Activation
		complete_effect = {
			var:global.POR_iberian_summit_target = {
				add_opinion_modifier = {
					target = ROOT
					modifier = POR_iberian_summit_diplomatic_approach
				}
			}
		}

		#Fail
		cancel_effect = {
			remove_opinion_modifier = {	target = POR modifier = POR_iberian_summit_working_together	}
			var:global.POR_iberian_summit_target = {
				remove_opinion_modifier = { target = POR modifier = POR_iberian_summit_diplomatic_approach }
			}
			if = { 
				limit = { country_exists = SPA }
				remove_opinion_modifier = {	target = SPA modifier = POR_iberian_summit_working_together	}
				var:global.POR_iberian_summit_target = {
					remove_opinion_modifier = { target = SPA modifier = POR_iberian_summit_diplomatic_approach }
				}
			}
			else = {
				remove_opinion_modifier = {	target = SPD modifier = POR_iberian_summit_working_together	}
				var:global.POR_iberian_summit_target = {
					remove_opinion_modifier = { target = SPA modifier = POR_iberian_summit_diplomatic_approach }
				}
			}
			
			clr_global_flag = POR_iberian_summit_in_progress_flag
			clr_global_flag = POR_iberian_summit_proposal_delayed_flag
			clr_country_flag = POR_iberian_summit_initiator_flag  
			clear_variable = global.POR_iberian_summit_target
		}

		#Success
		remove_effect = {
			if = {
				limit = {
					has_country_flag = POR_iberian_summit_initiator_flag
				}
				if = {
					limit = {
						check_variable = {
						    var = global.POR_iberian_summit_target
						    value = GER
						    compare = equals
						}
					}
					var:global.POR_iberian_summit_target = { 
						country_event = { id = lar_portugal_iberian_summit.4 hours = 8 random_hours = 4 }
					}
				}
				else = {
					var:global.POR_iberian_summit_target = { 
						country_event = { id = lar_portugal_iberian_summit.8 hours = 8 random_hours = 4 }
					}
				}
			}
			clr_global_flag = POR_iberian_summit_in_progress_flag
			clr_global_flag = POR_iberian_summit_proposal_delayed_flag
			clr_country_flag = POR_iberian_summit_initiator_flag
		}
	}
}

POR_monarchist_cause = {

	POR_stir_monarchist_sentiment_in_brazil = {
		icon = generic_political_discourse

		allowed = {
			has_dlc = "La Resistance"
			original_tag = POR
		}

		available = {
			BRA = { 
				has_war = no 
			}
		}

		cost = 25
		fire_only_once = no

		ai_will_do = {
			base = 1
		}
		visible = {
			has_completed_focus = POR_a_royal_wedding
			NOT = { has_completed_focus = POR_the_empire_of_brazil }
			country_exists = BRA
		}

		cancel_trigger = {
			OR = {
				has_completed_focus = POR_the_empire_of_brazil
				has_war_with = BRA
				BRA = { neutrality < -0.15 }
			}
		}

		cancel_effect = {
			BRA = {
				clr_country_flag = POR_portugal_stirring_brazilian_monarchists_flag
				set_country_flag = POR_brazilian_monarchists_stirred_flag
			}
		}

		modifier = {
			political_power_gain = -0.5
		}
		days_remove = 180

		remove_effect = {
			BRA = {
				clr_country_flag = POR_portugal_stirring_brazilian_monarchists_flag
				set_country_flag = POR_brazilian_monarchists_stirred_flag
			}
		}

		complete_effect = {
			custom_effect_tooltip = POR_stir_monarchist_sentiment_in_brazil_tt
			BRA = { 
				activate_decision = POR_portugal_promoting_monarchist_cause_in_brazil
				set_country_flag = POR_portugal_stirring_brazilian_monarchists_flag 
				country_event = { id = lar_portugal_promote_monarchist_cause.1 }
			}
		}
	}

	#Mission for BRA when POR starts promoting monarchist cause in BRA.
	POR_portugal_promoting_monarchist_cause_in_brazil = {
		icon = generic_civil_support

		allowed = {
			has_dlc = "La Resistance"
			original_tag = BRA
		}

		visible = {
			has_country_flag = POR_portugal_stirring_brazilian_monarchists_flag
		}

		cancel_trigger = {
			OR = {
				NOT = { has_country_flag = POR_portugal_stirring_brazilian_monarchists_flag }
				POR = { has_completed_focus = POR_the_empire_of_brazil }
				neutrality < -0.15
				has_war_with = POR
			}
		}

		fire_only_once = no

		modifier = {
			neutrality_drift = 0.1
			stability_weekly = -0.01
		}

		days_remove = 180
	}

	#Decision for BRA to fight brazilian monarchists
	POR_repress_brazilian_monarchists = {
		icon = oppression

		allowed = {
			has_dlc = "La Resistance"
			original_tag = BRA
		}

		available = {
			neutrality < 1
		}

		cost = 25
		fire_only_once = no

		ai_will_do = {
			factor = 0
		}
		visible = {
			OR = {
				has_country_flag = POR_portugal_stirring_brazilian_monarchists_flag
				has_country_flag = POR_brazilian_monarchists_stirred_flag
			}
			country_exists = POR
			POR = { NOT = { has_completed_focus = POR_the_empire_of_brazil } }		
		}

		cancel_trigger = {
			POR = { has_completed_focus = POR_the_empire_of_brazil }
		}

		modifier = {
			stability_factor = -0.05
			political_power_gain  = -0.5
			neutrality_drift = -0.1
		}

		days_remove = 180

		remove_effect = {
			clr_country_flag = POR_brazilian_monarchists_stirred_flag
		}
	}

	#Decision to boost unaligned popularity in Portugal 
	POR_stir_monarchist_sentiment_in_portugal = {
		icon = generic_political_discourse

		allowed = {
			has_dlc = "La Resistance"
			original_tag = POR
		}

		available = {
			neutrality < 1
		}

		cost = 25
		fire_only_once = no

		ai_will_do = {
			base = 1
		}
		visible = {
			has_completed_focus = POR_a_royal_wedding
			NOT = { has_completed_focus = POR_restoration_of_the_monarchy }
		}

		cancel_trigger = {
			has_completed_focus = POR_restoration_of_the_monarchy
		}

		modifier = {
			political_power_gain = -0.5
			neutrality_drift = 0.1
			stability_weekly = -0.01
		}
		days_remove = 180
	}
}

POR_prospect_for_resources = {
	POR_develop_lisbon_tungsten_deposits = { #112
		
		icon = tungsten

		allowed = {

		}

		highlight_states = {
			state = 112
		}

		available = {
			has_completed_focus = POR_extraction_industries
			num_of_civilian_factories_available_for_projects > 2
			owns_state = 112
			controls_state = 112
		}

		visible = {
			owns_state = 112
			controls_state = 112
			112 = {
				NOT = {	has_state_flag = POR_lisbon_tungsten_developed_flag }
			}
		}

		cost = 25
		days_remove = 90
		fire_only_once = yes

		modifier = {
			civilian_factory_use = 3
		}

		remove_effect = {
			112 = {	set_state_flag = POR_lisbon_tungsten_developed_flag }
			112 = {
				add_resource = {
					type = tungsten
					amount = 10
				}
			}
		}

		ai_will_do = {
			factor = 1
			modifier = {
				has_political_power < 200
				factor = 0
			}
		}
	}

	POR_develop_santarem_chromium_deposits = { #795
		
		icon = chromium

		allowed = {

		}

		highlight_states = {
			state = 795
		}

		available = {
			has_completed_focus = POR_extraction_industries
			num_of_civilian_factories_available_for_projects > 1
			owns_state = 795
			controls_state = 795
		}

		visible = {
			owns_state = 795
			controls_state = 795
			795 = {
				NOT = {
					has_state_flag = { 
						flag = POR_santarem_chromium_developed_flag
						value = 5
					}
				}
			}
		}

		cost = 25
		days_remove = POR_santarem_chromium_duration

		modifier = {
			civilian_factory_use = 1
		}

		remove_effect = {
			add_to_variable = { var = POR_santarem_chromium_duration value = 30 }
			795 = {
				if = {
					limit = {
						NOT = {
							has_state_flag = POR_santarem_chromium_developed_flag
						}
					}
					set_state_flag = {
						flag = POR_santarem_chromium_developed_flag
						value = 1
					}
				}
				else = {
					modify_state_flag = {
						flag = POR_santarem_chromium_developed_flag
						value = 1
					}
				}
			}
			795 = {
				add_resource = {
					type = chromium
					amount = 2
				}
			}
		}

		ai_will_do = {
			factor = 1
			modifier = {
				has_political_power < 200
				factor = 0
			}
		}

		complete_effect = {
			if = {
				limit = {
					check_variable = { var = POR_santarem_chromium_duration value = 30 compare = less_than }
				}
				set_variable = { var = POR_santarem_chromium_duration value = 15 }
			}
		}
	}
}


POR_the_spanish_civil_war = {
	POR_fight_alongside_the_republic = {
		icon = generic_prepare_civil_war

		available = {
			has_manpower > 10000
			has_stability > 0.5
			OR = {
				AND = {
					country_exists = SPA
					NOT = { has_war_with = SPA }
				}
				AND = {
					country_exists = SPC
					NOT = { has_war_with = SPC }
				}
				AND = {
					country_exists = SPB
					NOT = { has_war_with = SPB }
				}
			}
		}

		cost = 0
		fire_only_once = yes

		ai_will_do = {
			factor = 1
			modifier = {
				OR = {
					has_stability < 0.3
					has_manpower < 50000
				}
				factor = 0
			}
		}

		visible = {
			SPR_scw_in_progress = yes
			country_exists = SPD
			NOT = { has_war_with = SPD }
			has_completed_focus = POR_they_need_our_help
		}
		complete_effect = {
			hidden_effect = {
				set_country_flag = POR_supports_SPD_flag
			}	
			if = {
				limit = { country_exists = SPA }
				add_to_war = { targeted_alliance = SPD enemy = SPA hostility_reason = asked_to_join }
			}
			if = {
				limit = { country_exists = SPC }
				add_to_war = { targeted_alliance = SPD enemy = SPC hostility_reason = asked_to_join }
			}
			if = {
				limit = { country_exists = SPB }
				add_to_war = { targeted_alliance = SPD enemy = SPB hostility_reason = asked_to_join }
			}
			effect_tooltip = {
				give_military_access = SPD
				SPD = { give_military_access = ROOT }
			}
			hidden_effect = {
				diplomatic_relation = {
					country = SPD
					relation = military_access
					active = yes
				}
				SPD = {
					diplomatic_relation = {
						country = POR
						relation = military_access
						active = yes
					}
				}
			}
		}
	}

	POR_fight_alongside_the_nationalists = {
		icon = generic_prepare_civil_war

		available = {
			has_manpower > 10000
			has_stability > 0.5
			OR = {
				AND = {
					country_exists = SPD
					NOT = { has_war_with = SPD }
				}
				AND = {
					country_exists = SPC
					NOT = { has_war_with = SPC }
				}
				AND = {
					country_exists = SPB
					NOT = { has_war_with = SPB }
				}
			}
		}

		cost = 0
		fire_only_once = yes

		ai_will_do = {
			factor = 1
			modifier = {
				OR = {
					has_stability < 0.3
					has_manpower < 50000
				}
				factor = 0
			}
		}

		visible = {
			SPR_scw_in_progress = yes
			country_exists = SPA
			NOT = { has_war_with = SPA }
			has_completed_focus = POR_send_assistance
		}
		complete_effect = {
			hidden_effect = {
				set_country_flag = POR_supports_SPA_flag
			}	
			if = {
				limit = { country_exists = SPD }
				add_to_war = { targeted_alliance = SPA enemy = SPD hostility_reason = asked_to_join }
			}
			if = {
				limit = { country_exists = SPC }
				add_to_war = { targeted_alliance = SPA enemy = SPC hostility_reason = asked_to_join }
			}
			if = {
				limit = { country_exists = SPB }
				add_to_war = { targeted_alliance = SPA enemy = SPB hostility_reason = asked_to_join }
			}
			effect_tooltip = {
				give_military_access = SPA
				SPA = { give_military_access = ROOT }
			}
			hidden_effect = {
				diplomatic_relation = {
					country = SPA
					relation = military_access
					active = yes
				}
				SPA = {
					diplomatic_relation = {
						country = POR
						relation = military_access
						active = yes
					}
				}
			}
		}
	}

	POR_fight_alongside_the_carlists = {
		icon = generic_prepare_civil_war

		available = {
			has_manpower > 10000
			has_stability > 0.5
			OR = {
				AND = {
					country_exists = SPD
					NOT = { has_war_with = SPD }
				}
				AND = {
					country_exists = SPC
					NOT = { has_war_with = SPC }
				}
				AND = {
					country_exists = SPA
					NOT = { has_war_with = SPA }
				}
			}
		}

		cost = 0
		fire_only_once = yes

		ai_will_do = {
			factor = 1
			modifier = {
				OR = {
					has_stability < 0.3
					has_manpower < 50000
				}
				factor = 0
			}
		}

		visible = {
			SPR_scw_in_progress = yes
			country_exists = SPB
			NOT = { has_war_with = SPB }
			has_completed_focus = POR_join_the_carlist_fight
		}
		complete_effect = {
			hidden_effect = {
				set_country_flag = POR_supports_SPB_flag
			}	
			if = {
				limit = { country_exists = SPD }
				add_to_war = { targeted_alliance = SPB enemy = SPD hostility_reason = asked_to_join }
			}
			if = {
				limit = { country_exists = SPC }
				add_to_war = { targeted_alliance = SPB enemy = SPC hostility_reason = asked_to_join }
			}
			if = {
				limit = { country_exists = SPA }
				add_to_war = { targeted_alliance = SPB enemy = SPA hostility_reason = asked_to_join }
			}
			effect_tooltip = {
				give_military_access = SPB
				SPB = { give_military_access = ROOT }
			}
			hidden_effect = {
				diplomatic_relation = {
					country = SPB
					relation = military_access
					active = yes
				}
				SPB = {
					diplomatic_relation = {
						country = POR
						relation = military_access
						active = yes
					}
				}
			}
		}
	}
}
