gc_spain_1 = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
	}
	potential = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
		OR = {
			tag = CAS
			AND = {
				tag = SPA
				NOT = { primary_culture = aragonese }
				NOT = { primary_culture = catalan }
			}
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	gc_cas_spa_plus_ultra = {
		icon = mission_plus_ultra
		required_missions = { }
		completed_by = 1492.1.1

		provinces_to_highlight = {
			province_id = 4565
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}

		trigger = {
			num_of_explorers = 1
			custom_trigger_tooltip = {
				tooltip = spa_plus_ultra_tooltip
				OR = {
					owns_core_province = 4565
					any_owned_province = {
						OR = {
							continent = north_america
							continent = south_america
							continent = new_world
						}
					}
				}
			}
		}
		effect = {
			add_country_modifier = {
				name = "spa_plus_ultra"
				duration = 7300
			}
		}
	}
	gc_cas_spa_caribbean_discovery = {
		icon = mission_establish_high_seas_navy
		required_missions = { gc_cas_spa_plus_ultra }
		position = 4
		completed_by = 1492.1.1

		# free mission

		trigger = {
			if = {
				limit = {
					is_random_new_world = yes
				}
				custom_trigger_tooltip = {
					tooltip = cas_carib_rnw
					any_owned_province = {
						continent = new_world
					}
				}
			}
			else = {
				custom_trigger_tooltip = {
					tooltip = miss_discover_caribbean
					colonial_the_carribean = { has_discovered = ROOT }
				}
			}
		}

		effect = {
			if = {
				limit = {
					owns_core_province = 224
				}
				set_country_flag = sevilla_trade_center_flag
				country_event = { id = flavor_spa.3153 }
			}
			add_country_modifier = {
				name = "spa_hispaniola_discovered"
				duration = 5475
			}
		}
	}
}

gc_spain_1_b = {
	slot = 1
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
	}
	potential = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
		OR = {
			tag = CAS
			AND = {
				tag = SPA
				NOT = { primary_culture = aragonese }
				NOT = { primary_culture = catalan }
			}
		}
		NOT = { map_setup = map_setup_random }
		is_random_new_world = no
	}
	has_country_shield = yes

	gc_cas_spa_caribbean_colony = {
		icon = mission_iberian_conquistador
		required_missions = { gc_cas_spa_caribbean_discovery }
		position = 5
		completed_by = 1493.1.1

		# free mission

		provinces_to_highlight = {
			colonial_region = colonial_the_carribean
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
			has_discovered = ROOT
		}

		trigger = {
			custom_trigger_tooltip = {
				tooltip = miss_colonize_caribbean
				num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
					value = 1
					colonial_region = colonial_the_carribean
					is_city = yes
				}
			}
		}

		effect = {
			add_prestige = 15
			add_country_modifier = {
				name = "the_unknown_frontier"
				duration = 5475
			}
		}
	}
	gc_cas_spa_havana = {
		icon = mission_found_havana
		required_missions = { gc_cas_spa_caribbean_colony }
		completed_by = 1493.1.1

		provinces_to_highlight = {
			OR = {
				area = cuba_area
				area = east_cuba_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
			has_discovered = ROOT
		}

		trigger = {
			if = {
				limit = {
					has_dlc = "Rights of Man"
				}
				484 = {
					country_or_non_sovereign_subject_holds = ROOT
					OR = {
						has_building = workshop
						has_building = counting_house
					}
				}
			}
			else = {
				484 = {
					country_or_non_sovereign_subject_holds = ROOT
				}
			}
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value =  5
				OR = {
					area = cuba_area
					area = east_cuba_area
				}
			}
		}
		effect = {
			set_country_flag = spa_house_of_trade_flag
			country_event = { id = flavor_spa.1003 }
			if = {
				limit = {
					any_subject_country = {
						OR = {
							is_subject_of_type = colony
							is_subject_of_type = crown_colony
							is_subject_of_type = private_enterprise
							is_subject_of_type = self_governing_colony
						}
						owns = 484
					}
				}
				every_subject_country = {
					limit = {
						owns = 484
					}
					484 = {
						prev_move_capital_effect = yes
					}
				}
			}
			central_america_region = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	gc_cas_spa_mayans = {
		icon = mission_mayan_conquest
		required_missions = { gc_cas_spa_havana }
		completed_by = 1493.1.1
		position = 7

		provinces_to_highlight = {
			region = central_america_region
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
			has_discovered = ROOT
		}

		trigger = {
			custom_trigger_tooltip = {
				tooltip = spa_mayan_conquest_tooltip
				central_america_region = {
					type = all
					OR = {
						is_empty = yes
						country_or_non_sovereign_subject_holds = ROOT
					}
				}
			}
		}
		effect = {
			add_treasury = 500
		}
	}
	gc_cas_spa_california = {
		icon = mission_colonize_california
		required_missions = { gc_cas_spa_new_spain }
		position = 9
		#completed_by = 1521.1.1

		provinces_to_highlight = {
			colonial_region = colonial_california
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
			has_discovered = ROOT
		}

		trigger = {
			if = {
				limit = {
					has_dlc = "Golden Century"
					religion = catholic
				}
				2021 = {
					country_or_non_sovereign_subject_holds = ROOT
					has_holy_order_trigger = yes
				}
			}
			else = {
				2021 = {
					country_or_non_sovereign_subject_holds = ROOT
					religion = ROOT
				}
			}
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 5
				colonial_region = colonial_california
				is_city = yes
			}
		}
		effect = {
			add_dip_power = 100
			2021 = {
				add_base_tax = 3
			}
			colonial_california = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
}

gc_spain_2 = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
	}
	potential = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
		OR = {
			tag = CAS
			AND = {
				tag = SPA
				NOT = { primary_culture = aragonese }
				NOT = { primary_culture = catalan }
			}
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	gc_cas_spa_navarra = {
		icon = mission_subjugate_navarra
		required_missions = { gc_cas_spa_army_ready }
		completed_by = 1493.1.1
		position = 2

		provinces_to_highlight = {
			province_id = 210
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}

		trigger = {
			210 = {
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			if = {
				limit = {
					210 = {
						NOT = {
							OR = {
								has_building = fort_15th
								has_building = fort_16th
								has_building = fort_17th
								has_building = fort_18th
							}
						}
					}
				}
				210 = {
					add_building = fort_15th
				}
			}
			210 = {
				add_province_modifier = {
					name = "fortified_navarra"
					duration = 7300
				}
			}
			if = {
				limit = {
					exists = POR
					valid_for_personal_unions_trigger = yes
					POR = {
						valid_for_personal_unions_trigger = yes
					}
				}
				if = {
					limit = {
						mission_completed = gc_cas_spa_reconquista_one
					}
					add_casus_belli = {
						type = cb_restore_personal_union
						months = 300
						target = POR
					}
				}
				else = {
					custom_tooltip = gc_cas_spa_navarra_ct
				}
			}
			else_if = {
				limit = {
					mission_completed = gc_cas_spa_reconquista_one
				}
				alentejo_area = {
					limit = {
						NOT = { is_permanent_claim = ROOT }
						NOT = { is_core = ROOT	}
					}
					add_permanent_claim = ROOT
				}
				beieras_area = {
					limit = {
						NOT = { is_permanent_claim = ROOT }
						NOT = { is_core = ROOT	}
					}
					add_permanent_claim = ROOT
				}
			}
			else = {
				custom_tooltip = gc_cas_spa_navarra_bt
			}
		}
	}

	gc_cas_spa_expel_moriscos = {
		icon = mission_expel_the_moriscos
		required_missions = { gc_cas_spa_iberia_christian }
		completed_by = 1493.1.1
		position = 4

		provinces_to_highlight = {
			OR = {
				area = upper_andalucia_area
				area = lower_andalucia_area
			}
			NOT = { culture = ROOT }
		}

		trigger = {
			upper_andalucia_area = {
				type = all
				culture = ROOT
			}
			lower_andalucia_area = {
				type = all
				culture = ROOT
			}
		}
		effect = {
			add_dip_power = 100
			add_country_modifier = {
				name = "displaced_moriscos"
				duration = 7300
			}
		}
	}
}

gc_spain_2_b = {
	slot = 2
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
	}
	potential = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
		OR = {
			tag = CAS
			AND = {
				tag = SPA
				NOT = { primary_culture = aragonese }
				NOT = { primary_culture = catalan }
			}
		}
		NOT = { map_setup = map_setup_random }
		is_random_new_world = no
	}
	has_country_shield = yes
	gc_cas_spa_hispaniola = {
		icon = mission_claim_hispaniola
		required_missions = { gc_cas_spa_caribbean_colony }
		completed_by = 1493.1.1
		position = 6

		provinces_to_highlight = {
			OR = {
				AND = {
					OR = {
						area = hispaniola_area
						area = dominica_area
					}
					NOT = { country_or_non_sovereign_subject_holds = ROOT }

				}
				province_id = 490
			}
			has_discovered = ROOT
		}

		trigger = {
			if = {
				limit = {
					has_dlc = "Rights of Man"
				}
				490 = {
					country_or_non_sovereign_subject_holds = ROOT
					OR = {
						has_building = temple
						has_building = cathedral
					}
				
				}
			}
			else = {
				490 = {
					country_or_non_sovereign_subject_holds = ROOT
				}
			}
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 5
				OR = {
					area = hispaniola_area
					area = dominica_area
				}
				is_city = yes
			}
		}
		effect = {
			define_conquistador = {
				shock = 5
				fire = 5
				manuever = 6
				siege = 1
				name = "000000000"
			}
			490 = {
				add_base_production = 3
				if = {
					limit = {
						NOT = {
							trade_goods = sugar
						}
					}
					change_trade_goods = sugar
				}
			}
			mexico_area = {
				limit = {
					NOT = { is_permanent_claim = ROOT	}
					NOT = { is_core = ROOT	}
				}
				add_permanent_claim = ROOT
			}
			eastern_mexico_area = {
				limit = {
					NOT = { is_permanent_claim = ROOT	}
					NOT = { is_core = ROOT	}
				}
				add_permanent_claim = ROOT
			}
			puebla_area = {
				limit = {
					NOT = { is_permanent_claim = ROOT	}
					NOT = { is_core = ROOT	}
				}
				add_permanent_claim = ROOT
			}
		}
	}
	gc_cas_spa_aztecs = {
		icon = mission_iberian_conquistador
		required_missions = { gc_cas_spa_hispaniola }
		completed_by = 1521.1.1

		# free mission

		provinces_to_highlight = {
			OR = {
				area = mexico_area
				area = eastern_mexico_area
				area = puebla_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
			has_discovered = ROOT
		}

		trigger = {
			mexico_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			eastern_mexico_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			puebla_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}

		effect = {
			add_treasury = 800
			mexico_region = {
				limit = {
					NOT = { is_permanent_claim = ROOT	}
					NOT = { is_core = ROOT	}
				}
				add_permanent_claim = ROOT
			}
		}
	}
	gc_cas_spa_new_spain = {
		icon = mission_kingdom_of_new_spain
		required_missions = { gc_cas_spa_aztecs gc_cas_spa_mayans }
		position = 8
		completed_by = 1521.1.1

		provinces_to_highlight = {
			region = mexico_region
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
			has_discovered = ROOT
		}

		trigger = {
			if = {
				limit = {
					has_dlc = "Golden Century"
					religion = catholic
				}
				custom_trigger_tooltip = {
					tooltip = mexico_holy_order_tooltip
					num_of_states_owned_or_owned_by_non_sovereign_subjects_with = {
						has_holy_order_trigger = yes
						region = mexico_region
						value = 5
					}
				}
			}
			else = {
				custom_trigger_tooltip = {
					tooltip = mexico_holy_order_alternative_tooltip
					num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
						religion = ROOT
						region = mexico_region
						value = 25
					}
				}
			}
			mexico_region = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_country_modifier = {
				name = "viceroyalty_of_new_spain"
				duration = 7300
			}
			if = {
				limit = {
					any_subject_country = {
						OR = {
							is_subject_of_type = colony
							is_subject_of_type = crown_colony
							is_subject_of_type = private_enterprise
							is_subject_of_type = self_governing_colony
						}
						owns = 852
					}
					852 = { is_capital = no }
				}
				every_subject_country = {
					limit = {
						owns = 852
					}
					852 = {
						prev_move_capital_effect = yes
					}
				}
			}
			west_florida_area = {
				limit = {
					NOT = { is_permanent_claim = ROOT }
					NOT = { is_core = ROOT	}
					is_empty = no
				}
				add_permanent_claim = ROOT
			}
		}
	}
	gc_cas_spa_florida = {
		icon = mission_colonize_florida
		required_missions = { gc_cas_spa_new_spain }
		position = 9
		#completed_by = 1521.1.1

		provinces_to_highlight = {
			OR = {
				region = southeast_america_region
				area = west_florida_area
			}
			OR = {
				NOT = { country_or_non_sovereign_subject_holds = ROOT }
				NOT = { fort_level = 3 }
			}
			has_discovered = ROOT
		}

		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 3
				OR = {
					region = southeast_america_region
					area = west_florida_area
				}
				fort_level = 3
			}
		}
		effect = {
			add_mil_power = 100
			custom_tooltip = fortified_florida_tooltip
			hidden_effect = {
				every_province = {
					limit = {
						OR = {
							owned_by = ROOT
							owner = {
								is_subject_of = ROOT
							}
						}
						OR = {
							region = southeast_america_region
							area = west_florida_area
						}
						fort_level = 3
					}
					add_province_modifier = {
						name = "fortified_florida_modifier"
						duration = -1
					}
				}
			}
		}
	}
}

gc_spain_3 = {
		slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
	}
	potential = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
		OR = {
			tag = CAS
			AND = {
				tag = SPA
				NOT = { primary_culture = aragonese }
				NOT = { primary_culture = catalan }
			}
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	gc_cas_spa_army_ready = {
		icon = mission_assemble_an_army
		required_missions = {  }
		completed_by = 1445.1.1

		# free mission

		trigger = {
			army_size_percentage = 1
			navy_size_percentage = 1
			manpower_percentage = 0.6
			num_of_generals = 1
		}

		effect = {
			add_country_modifier = {
				name = "spa_rb_morale"
				duration = 5475
			}
			upper_andalucia_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			210 = {
				if = {
					limit = {
						NOT = {
							is_permanent_claim = ROOT
							is_core = ROOT
						}
					}
					add_permanent_claim = ROOT
				}
			}
		}
	}
	gc_cas_spa_reconquista_one = {
		icon = mission_unite_home_region
		required_missions = { gc_cas_spa_army_ready }
		completed_by = 1492.1.1

		provinces_to_highlight = {
			area = upper_andalucia_area
			NOT = { owned_by = ROOT }
		}

		trigger = {
			upper_andalucia_area = {
				type = all
				owned_by = ROOT
			}
		}

		effect = {
			set_country_flag = fate_of_granada_mission_flag
			country_event = {
				id = flavor_spa.8
			}
			if = {
				limit = {
					exists = POR
					valid_for_personal_unions_trigger = yes
					POR = {
						valid_for_personal_unions_trigger = yes
					}
				}
				if = {
					limit = {
						mission_completed = gc_cas_spa_navarra
					}
					add_casus_belli = {
						type = cb_restore_personal_union
						months = 300
						target = POR
					}
				}
				else = {
					custom_tooltip = gc_cas_spa_reconquista_one_ct
				}
			}
			else_if = {
				limit = {
					mission_completed = gc_cas_spa_navarra
				}
				alentejo_area = {
					limit = {
						NOT = { is_permanent_claim = ROOT }
						NOT = { is_core = ROOT	}
					}
					add_permanent_claim = ROOT
				}
				beieras_area = {
					limit = {
						NOT = { is_permanent_claim = ROOT }
						NOT = { is_core = ROOT	}
					}
					add_permanent_claim = ROOT
				}
			}
			else = {
				custom_tooltip = gc_cas_spa_reconquista_one_bt
			}
		}
	}
	gc_cas_spa_iberia_christian = {
		icon = mission_religious
		required_missions = { gc_cas_spa_reconquista_one }
		completed_by = 1511.1.1

		# free mission

		provinces_to_highlight = {
			region = iberia_region
			NOT = { religion_group = ROOT }
		}

		trigger = {
			iberia_region = {
				type = all
				religion_group = ROOT
			}
		}

		effect = {
			add_country_modifier = {
				name = "spa_rb_christian_iberia"
				duration = 5475
			}
			126 = {
				add_permanent_claim = ROOT
			}
			northern_morocco_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	gc_cas_spa_reconquista_four = {
		icon = mission_assemble_an_army
		required_missions = { gc_cas_spa_iberia_christian }

		# free mission

		provinces_to_highlight = {
			area = northern_morocco_area
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}

		trigger = {
			northern_morocco_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}

		effect = {
			add_country_modifier = {
			name = "completing_the_reconquista"
			duration = 5475
			}
			western_morocco_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_claim = ROOT }
				}
				add_claim = ROOT
			}
			algiers_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_claim = ROOT }
				}
				add_claim = ROOT
			}
		}
	}
}

gc_spain_3_b = {
		slot = 3
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
	}
	potential = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
		OR = {
			tag = CAS
			AND = {
				tag = SPA
				NOT = { primary_culture = aragonese }
				NOT = { primary_culture = catalan }
			}
		}
		NOT = { map_setup = map_setup_random }
		is_random_new_world = no
	}
	has_country_shield = yes

	gc_cas_spa_spanish_main = {
		icon = mission_establish_high_seas_navy
		required_missions = { gc_cas_spa_caribbean_discovery }
		completed_by = 1509.1.1
		position = 5

		provinces_to_highlight = {
			colonial_region = colonial_colombia
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
			has_discovered = yes
		}

		# free mission

		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 5
				colonial_region = colonial_colombia
				is_city = yes
			}
		}

		effect = {
			define_conquistador = {
				name = "Francisco Pizarro"
				fire = 4
				shock = 4
				manuever = 5
				siege = 1
			}
			upper_peru = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			potosi_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			antisuyu_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			kuntisuyu_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			huanuco_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			cajamarca_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			quito_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			794 = {
				add_permanent_claim = ROOT
			}
			2837 = {
				add_permanent_claim = ROOT
			}
			2823 = {
				add_permanent_claim = ROOT
			}
			2826 = {
				add_permanent_claim = ROOT
			}
			812 = {
				add_permanent_claim = ROOT
			}
			2822 = {
				add_permanent_claim = ROOT
			}
			2821 = {
				add_permanent_claim = ROOT
			}
			guatemala_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			east_yucatan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			yucatan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			chiapas_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			oaxaca_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}

			eastern_mexico_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			guerrero_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			michoacan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			2657 = {
				add_permanent_claim = ROOT
			}
			2621 = {
				add_permanent_claim = ROOT
			}
			854 = {
				add_permanent_claim = ROOT
			}
			2642 = {
				add_permanent_claim = ROOT
			}
		}
	}
	gc_cas_spa_incans = {
		icon = mission_war_chest
		required_missions = { gc_cas_spa_spanish_main }
		position = 7
		completed_by = 1536.1.1

		# free mission

		provinces_to_highlight = {
			OR = {
				area = upper_peru
				area = potosi_area
				area = antisuyu_area
				area = kuntisuyu_area
				province_id = 794
				province_id = 2837
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
			has_discovered = ROOT
		}

		trigger = {
			upper_peru = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			potosi_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			antisuyu_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			kuntisuyu_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			794 = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			2837 = {
				country_or_non_sovereign_subject_holds = ROOT
			}
		}

		effect = {
			add_treasury = 500
			peru_region = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	gc_cas_spa_potosi = {
		icon = mission_potosi_silver
		required_missions = { gc_cas_spa_incans gc_cas_spa_west_africa }
		#completed_by = 1509.1.1

		provinces_to_highlight = {
			OR = {
				AND = {
					province_id = 795
					NOT = { country_or_non_sovereign_subject_holds = ROOT }
				}
				AND = {
					province_id = 809
					NOT = { country_or_non_sovereign_subject_holds = ROOT }
				}
				AND = {
					OR = {
						province_id = 809
						province_id = 835
						province_id = 1516
					}
					NOT = { is_strongest_trade_power = ROOT }
				}
				AND = { 
					province_id = 809 
					NOT = { province_has_center_of_trade_of_level = 3 }
				}
			}
		}

		trigger = {
			owns_or_non_sovereign_subject_of = 809
			owns_or_non_sovereign_subject_of = 795
			809 = {
				country_or_non_sovereign_subject_holds = ROOT
			}
			if = {
				limit = {
					has_dlc = "Dharma"
				}
				809 = {
					province_has_center_of_trade_of_level = 3
				}
			}
			else = {
				809 = {
					OR = {
						has_building = trade_depot
						has_building = stock_exchange
					}
				}
			}
			809 = {
				is_strongest_trade_power = ROOT
			}
			835 = {
				is_strongest_trade_power = ROOT
			}
			1516 = {
				is_strongest_trade_power = ROOT
			}
		}
		effect = {
			custom_tooltip = gc_cas_spa_potosi_tt
			hidden_effect = {
				if = {
					limit = {
						any_subject_country = {
							OR = {
								is_subject_of_type = colony
								is_subject_of_type = crown_colony
								is_subject_of_type = private_enterprise
								is_subject_of_type = self_governing_colony
							}
							owns = 809
						}
					}
					every_subject_country = {
						limit = {
							owns = 809
						}
						809 = {
							prev_move_capital_effect = yes
						}
					}
				}
			}
			if = {
				limit = {
					has_dlc = "Leviathan"
				}
				795 = {
					set_great_project_tier_2 = {
						type = potosi
					}
				}
			}
			else = {
				795 = {
					add_province_modifier = {
						name = "spa_rb_gold_rush"
						duration = 5475
					}
				}
			}
			2946 = {
				add_province_modifier = {
					name = "spa_rb_gold_rush"
					duration = 5475
				}
			}
			2941 = {
				add_province_modifier = {
					name = "spa_rb_gold_rush"
					duration = 5475
				}
			}
			804 = {
				add_province_modifier = {
					name = "spa_rb_gold_rush"
					duration = 5475
				}
			}
		}
	}
	gc_cas_spa_native_reductions = {
		icon = mission_native_reductions
		required_missions = { gc_cas_spa_potosi gc_cas_spa_new_spain }
		#completed_by = 1509.1.1
		position = 9

		provinces_to_highlight = {
			province_id = 216
			OR = {
				NOT = { country_or_non_sovereign_subject_holds = ROOT }
				NOT = { has_building = university }
			}
		}

		trigger = {
			if = {
				limit = {
					has_dlc = "Golden Century"
					religion = catholic
				}
				custom_trigger_tooltip = {
					tooltip = native_reductions_tooltip
					num_of_states_owned_or_owned_by_non_sovereign_subjects_with = {
						has_holy_order_trigger = yes
						OR = {
							continent = north_america
							continent = south_america
						}
						value = 15
					}
				}
			}
			else = {
				custom_trigger_tooltip = {
					tooltip = native_reductions_alternative_tooltip
					num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
						religion = ROOT
						OR = {
							continent = north_america
							continent = south_america
						}
						value = 75
					}
				}
			}			
			216 = { # school of salamanca
				has_building = university
			}
		}
		effect = {
			if = {
				limit = {
					religion = catholic
				}
				add_papal_influence = 50
			}
			else = {
				add_dip_power = 100
			}
			if = {
				limit = {
					any_country = {
						is_subject_of = ROOT
						OR = {
							is_subject_of_type = colony
							is_subject_of_type = crown_colony
							is_subject_of_type = private_enterprise
							is_subject_of_type = self_governing_colony
						}
					}
				}
				every_country = {
					limit = {
						is_subject_of = ROOT
						is_subject_of_type = colony
					}
					add_country_modifier = {
						name = "spa_native_reductions"
						duration = 7300
					}
				}
			}
		}
	}
}

gc_spain_4 = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
	}
	potential = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
		OR = {
			tag = CAS
			AND = {
				tag = SPA
				NOT = { primary_culture = aragonese }
				NOT = { primary_culture = catalan }
			}
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	gc_cas_spa_reconquista_three = {
		icon = mission_have_two_subjects
		required_missions = {  }
		completed_by = 1479.1.1

		provinces_to_highlight = {
			OR = {
				area = valencia_area
				area = catalonia_area
				area = aragon_area
			}
			NOT = { owned_by = ROOT }
		}

		trigger = {
			valencia_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			catalonia_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			aragon_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}

		effect = {
			if = {
				limit = {
					exists = NAP
					valid_for_personal_unions_trigger = yes
					NAP = {
						valid_for_personal_unions_trigger = yes
					}
				}
				add_casus_belli = {
					type = cb_restore_personal_union
					months = 300
					target = NAP
				}
				sicily_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				western_sicily_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				calabria_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				apulia_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				naples_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				120 = {
					if = {
						limit = {
							NOT = { is_core = ROOT }
							NOT = { is_permanent_claim = ROOT }
						}
					add_permanent_claim = ROOT
					}
				}
			}
			else = {
				sicily_area = {
					limit = {
						NOT = { country_or_non_sovereign_subject_holds = ROOT }
					}
					add_permanent_claim = ROOT
				}
				western_sicily_area = {
					limit = {
						NOT = { country_or_non_sovereign_subject_holds = ROOT }
					}
					add_permanent_claim = ROOT
				}
				calabria_area = {
					limit = {
						NOT = { country_or_non_sovereign_subject_holds = ROOT }
					}
					add_permanent_claim = ROOT
				}
				apulia_area = {
					limit = {
						NOT = { country_or_non_sovereign_subject_holds = ROOT }
					}
					add_permanent_claim = ROOT
				}
				naples_area = {
					limit = {
						NOT = { country_or_non_sovereign_subject_holds = ROOT }
					}
					add_permanent_claim = ROOT
				}
				120 = {
					if = {
						limit = {
							NOT = { country_or_non_sovereign_subject_holds = ROOT }
						}
						add_permanent_claim = ROOT
					}
				}
			}
		}
	}
	gc_cas_spa_italian_ambition = {
		icon = mission_italian_condottiere
		required_missions = { gc_cas_spa_reconquista_three }
		completed_by = 1516.1.1

		provinces_to_highlight = {
			OR = {
				area = sicily_area
				area = western_sicily_area
				area = calabria_area
				area = apulia_area
				area = naples_area
				province_id = 120
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}

		trigger = {
			OR = {
				NAP = {
					junior_union_with = ROOT
				}
				AND = {
					sicily_area = {
						type = all
						country_or_non_sovereign_subject_holds = ROOT
					}
					western_sicily_area = {
						type = all
						country_or_non_sovereign_subject_holds = ROOT
					}
					calabria_area = {
						type = all
						country_or_non_sovereign_subject_holds = ROOT
					}
					apulia_area = {
						type = all
						country_or_non_sovereign_subject_holds = ROOT
					}
					naples_area = {
						type = all
						country_or_non_sovereign_subject_holds = ROOT
					}
					120 = {
						country_or_non_sovereign_subject_holds = ROOT
					}
				}
			}
		}

		effect = {
			add_country_modifier = {
				name = "spa_rb_italian_ambition_mod"
				duration = 5475
			}
			tuscany_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			lombardy_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			po_valley_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			wallonia_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			flanders_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			brabant_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			hidden_effect = {
				remove_casus_belli = {
					type = cb_restore_personal_union
					target = NAP
				}
			}
		}
	}
	gc_cas_spa_italian_ambition_2 = {
		icon = mission_italian_conquest
		required_missions = { gc_cas_spa_italian_ambition }

		provinces_to_highlight = {
			OR = {
				area = tuscany_area
				area = lombardy_area
				area = po_valley_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}

		trigger = {
			tuscany_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			lombardy_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			po_valley_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_country_modifier = {
				name = "spa_milan"
				duration = 7300
			}
		}
	}
}

gc_spain_4_b = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
	}
	potential = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
		tag = SPA
		NOT = { primary_culture = aragonese }
		NOT = { primary_culture = catalan }
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	gc_spa_spanish_armada = {
		icon = mission_spanish_armada
		required_missions = { gc_spa_spanish_netherlands }
		position = 4

		trigger = {
			has_flagship = yes
			if = {
				limit = {
					exists = GBR
				}
				num_of_heavy_ship = GBR
			}
			else_if = {
				limit = {
					exists = ENG
				}
				num_of_heavy_ship = ENG
			}
			else = {
				num_of_heavy_ship = 20
			}
		}
		effect = {
			add_country_modifier = {
				name = "spa_prepared_armada"
				duration = 7300
			}
			if = {
				limit = {
					exists = GBR
					valid_for_personal_unions_trigger = yes
					GBR = {
						valid_for_personal_unions_trigger = yes
						NOT = { religion = ROOT }
					}
				}
				add_casus_belli = {
					type = cb_restore_personal_union
					months = 300
					target = GBR
				}
			}
			else_if = {
				limit = {
					exists = ENG
					valid_for_personal_unions_trigger = yes
					ENG = {
						valid_for_personal_unions_trigger = yes
						NOT = { religion = ROOT }
					}
				}
				add_casus_belli = {
					type = cb_restore_personal_union
					months = 300
					target = ENG
				}
			}
			else = {
				wessex_area = {
					limit = {
						NOT = { is_permanent_claim = ROOT }
						NOT = { is_core = ROOT	}
					}
					add_permanent_claim = ROOT
				}
				home_counties_area = {
					limit = {
						NOT = { is_permanent_claim = ROOT }
						NOT = { is_core = ROOT	}
					}
					add_permanent_claim = ROOT
				}
				east_anglia_area = {
					limit = {
						NOT = { is_permanent_claim = ROOT }
						NOT = { is_core = ROOT	}
					}
					add_permanent_claim = ROOT
				}
				east_midlands_area = {
					limit = {
						NOT = { is_permanent_claim = ROOT }
						NOT = { is_core = ROOT	}
					}
					add_permanent_claim = ROOT
				}
				west_midlands_area = {
					limit = {
						NOT = { is_permanent_claim = ROOT }
						NOT = { is_core = ROOT	}
					}
					add_permanent_claim = ROOT
				}
				yorkshire_area = {
					limit = {
						NOT = { is_permanent_claim = ROOT }
						NOT = { is_core = ROOT	}
					}
					add_permanent_claim = ROOT
				}
				custom_tooltip = cas_armada_info_tt
			}
		}
	}
	gc_spa_invade_england = {
		icon = mission_invade_england
		required_missions = { gc_spa_spanish_armada }

		provinces_to_highlight = {
			OR = {
				area = wessex_area
				area = home_counties_area
				area = east_anglia_area
				area = east_midlands_area
				area = west_midlands_area
				area = yorkshire_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}

		trigger = {
			wessex_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			home_counties_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			east_anglia_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			east_midlands_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			west_midlands_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			yorkshire_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			if = {
				limit = {
					GBR = {
						is_subject_of_type = personal_union
						is_subject_of = ROOT
						NOT = { religion = ROOT }
					}
				}
				GBR = {
					change_religion = ROOT
				}
			}
			else_if = {
				limit = {
					ENG = {
						is_subject_of_type = personal_union
						is_subject_of = ROOT
						NOT = { religion = ROOT }
					}
				}
				ENG = {
					change_religion = ROOT
				}
			}
			else = {
				add_prestige = 25
			}
			if = {
				limit = {
					religion = catholic
				}
				add_papal_influence = 25
			}
		}
	}
}

gc_spain_4_c = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
	}
	potential = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
		OR = {
			tag = CAS
			AND = {
				tag = SPA
				NOT = { primary_culture = aragonese }
				NOT = { primary_culture = catalan }
			}
		}
		NOT = { map_setup = map_setup_random }
		is_random_new_world = no
	}
	has_country_shield = yes

	gc_cas_spa_la_plata = {
		icon = mission_iberian_conquistador
		required_missions = { gc_cas_spa_spanish_main }
		completed_by = 1508.1.1
		position = 6

		provinces_to_highlight = {
			colonial_region = colonial_la_plata
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
			has_discovered = yes
		}

		trigger = {
			num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
				value = 5
				colonial_region = colonial_la_plata
				is_city = yes
			}
		}

		effect = {
			add_country_modifier = {
				name = "spa_rb_overseas_trade"
				duration = 5475
			}
		}
	}
}

gc_spain_4_d = {
	slot = 4
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
	}
	potential = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
		OR = {
			tag = CAS
			AND = {
				tag = SPA
				NOT = { primary_culture = aragonese }
				NOT = { primary_culture = catalan }
			}
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	gc_cas_spa_west_africa = {
		icon = mission_west_african_ports
		required_missions = {  }
		position = 7

		provinces_to_highlight = {
			OR = {
				AND = {
					region = guinea_region
					NOT = { country_or_non_sovereign_subject_holds = ROOT }
				}
				province_id = 1466
			}
			has_discovered = ROOT
		}

		trigger = {
			guinea_region = {
				owned_by = ROOT
			}
			1466 = {
				is_strongest_trade_power = ROOT
			}
		}
		effect = {
			add_mercantilism = 2
		}
	}
	gc_cas_spa_discover_spice_islands = {
		icon = mission_sail_to_the_east_indies
		required_missions = { gc_cas_spa_west_africa }

		trigger = {
			custom_trigger_tooltip = {
				tooltip = cas_spice_islands_tooltip
				moluccas_region = {
					type = all
					has_discovered = ROOT
				}
			}
		}
		effect = {
			mindanao_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			west_mindanao_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			visayas_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			palawan_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			luzon_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
			southern_luzon_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_permanent_claim = ROOT
			}
		}
	}
	gc_cas_spa_conquer_philippines = {
		icon = mission_las_islas_filipinas
		required_missions = { gc_cas_spa_discover_spice_islands }

		provinces_to_highlight = {
			OR = {
				area = mindanao_area
				area = west_mindanao_area
				area = visayas_area
				area = palawan_area
				area = luzon_area
				area = southern_luzon_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
			has_discovered = ROOT
		}

		trigger = {
			southern_luzon_area = {
				type = all
				owned_by = ROOT
			}
			luzon_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			mindanao_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			west_mindanao_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			visayas_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			palawan_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_army_tradition = 15
			southern_luzon_area = {
				limit = {
					owned_by = ROOT
				}
				change_religion = ROOT
			}
			luzon_area = {
				limit = {
					owned_by = ROOT
				}
				change_religion = ROOT
			}
			if = {
				limit = {
					has_dlc = "Dharma"
					656 = {
						NOT = {
							province_has_center_of_trade_of_level = 2
						}
					}
				}
				656 = {
					add_center_of_trade_level = 1
				}
			}
		}
	}
}

gc_castile_spain_5 = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
	}
	potential = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
		OR = {
			tag = CAS
			AND = {
				tag = SPA
				NOT = { primary_culture = aragonese }
				NOT = { primary_culture = catalan }
			}
		}
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes
	
	gc_cas_spa_reconquista_two = {
		icon = mission_cannons_firing
		required_missions = {
			gc_cas_spa_reconquista_three
		}
		position = 2

		# free mission

		provinces_to_highlight = {
			OR = {
				area = beieras_area
				area = alentejo_area
			}
			NOT = { owned_by = ROOT }
		}

		trigger = {
			beieras_area = {
				type = all
				owned_by = ROOT
			}
			alentejo_area = {
				type = all
				owned_by = ROOT
			}
		}

		effect = {
			add_prestige = 25
			add_adm_power = 100
		}
	}
}


gc_spain_5_a = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
	}
	potential = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
		tag = SPA
		NOT = { primary_culture = aragonese }
		NOT = { primary_culture = catalan }
		NOT = { map_setup = map_setup_random }
	}
	has_country_shield = yes

	gc_spa_spanish_netherlands = {
		icon = mission_spanish_netherlands
		required_missions = { gc_cas_spa_italian_ambition }
		position = 3

		provinces_to_highlight = {
			OR = {
				area = flanders_area
				area = wallonia_area
				area = brabant_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}

		trigger = {
			flanders_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
				religion = ROOT
			}
			wallonia_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
				religion = ROOT
			}
			brabant_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
				religion = ROOT
			}
		}
		effect = {
			if = {
				limit = {
					exists = HAB
					valid_for_personal_unions_trigger = yes
					HAB = {
						valid_for_personal_unions_trigger = yes
					}
				}
				add_casus_belli = {
					type = cb_restore_personal_union
					months = 300
					target = HAB
				}
			}
			else = {
				tirol_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				austria_proper_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
				inner_austria_area = {
					limit = {
						NOT = { is_core = ROOT }
						NOT = { is_permanent_claim = ROOT }
					}
					add_permanent_claim = ROOT
				}
			}
			north_brabant_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_claim = ROOT
			}
			frisia_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_claim = ROOT
			}
			holland_area = {
				limit = {
					NOT = { is_core = ROOT }
					NOT = { is_permanent_claim = ROOT }
				}
				add_claim = ROOT
			}
		}
	}
	gc_spa_austrian_union = {
		icon = mission_the_austrian_succession
		required_missions = { gc_spa_spanish_netherlands }

		provinces_to_highlight = {
			OR = {
				area = inner_austria_area
				area = austria_proper_area
				area = tirol_area
			}
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}

		trigger = {
			inner_austria_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			austria_proper_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
			tirol_area = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_country_modifier = {
				name = "spanish_imperial_ambition"
				duration = 7300
			}
		}
	}
	gc_spa_hre = {
		icon = mission_imperial_spain
		required_missions = { gc_spa_austrian_union }

		trigger = {
			OR = {
				ROOT = {
					is_emperor = yes
					if = {
						limit = {
							has_dlc = "Emperor"
						}
						hre_reform_passed = emperor_erbkaisertum
					}
					else = {
						hre_reform_passed = erbkaisertum
					}
				}
				AND = {
					NOT = { hre_size = 1 }
					NOT = { exists = HLR }
				}
			}
		}
		effect = {
			if = {
				limit = {
					is_emperor = yes
				}
				add_imperial_influence = 50
			}
			else = {
				add_prestige = 50
			}
		}
	}
}
gc_spain_5_c = {
	slot = 5
	generic = no
	ai = yes
	potential_on_load = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
	}
	potential = {
		has_dlc = "Golden Century"
		NOT = { has_dlc = "Domination" }
		OR = {
			tag = CAS
			AND = {
				tag = SPA
				NOT = { primary_culture = aragonese }
				NOT = { primary_culture = catalan }
			}
		}
		NOT = { map_setup = map_setup_random }
		is_random_new_world = no
	}
	has_country_shield = yes
	gc_cas_spa_new_granada = {
		icon = mission_new_kingdom_of_granada
		required_missions = { gc_cas_spa_spanish_main }
		completed_by = 1509.1.1
		position = 6

		provinces_to_highlight = {
			colonial_region = colonial_colombia
			NOT = { country_or_non_sovereign_subject_holds = ROOT }
		}

		trigger = {
			if = {
				limit = {
					has_dlc = "Golden Century"
					religion = catholic
				}
				custom_trigger_tooltip = {
					tooltip = colombia_holy_order_tooltip
					num_of_states_owned_or_owned_by_non_sovereign_subjects_with = {
						has_holy_order_trigger = yes
						colonial_region = colonial_colombia
						value = 5
					}
				}
			}
			else = {
				custom_trigger_tooltip = {
					tooltip = colombia_holy_order_alternative_tooltip
					num_of_provinces_owned_or_owned_by_non_sovereign_subjects_with = {
						religion = ROOT
						colonial_region = colonial_colombia
						value = 25
					}
				}
			}
			colonial_colombia = {
				type = all
				country_or_non_sovereign_subject_holds = ROOT
			}
		}
		effect = {
			add_dip_power = 100
			if = {
				limit = {
					government = monarchy
				}
				add_legitimacy = 25
			}
			add_country_modifier = {
				name = "spa_new_granada"
				duration = 7300
			}
			if = {
				limit = {
					any_subject_country = {
						OR = {
							is_subject_of_type = colony
							is_subject_of_type = crown_colony
							is_subject_of_type = private_enterprise
							is_subject_of_type = self_governing_colony
						}
						owns = 825
					}
					825 = { is_capital = no }
				}
				every_subject_country = {
					limit = {
						owns = 825
					}
					825 = {
						prev_move_capital_effect = yes
					}
				}
			}
		}
	}
}
