# RT56 RP Edits:
# add_state_core	--->	add_state_claim
# add_core_of 		--->	add_claim_by
hispaniola_category = {
	
	unite_hispaniola = { 

		icon = generic_form_nation

		allowed = {
			OR = {
				original_tag = HAI # Haiti
				original_tag = DOM # Dominican Republic
			}
		}

		available = {
			319 = {
				is_controlled_by = ROOT
			}
			318 = {
				is_controlled_by = ROOT
			}

		}

		visible = {
			OR = {
				original_tag = HAI # Haiti
				original_tag = DOM # Dominican Republic
			}
			
			NOT = {
				OR = {
					has_cosmetic_tag = CAB
					has_global_flag = hispaniola_flag
				} 
			}
			
		}
		
		highlight_states = {
			highlight_state_targets = {
                state = 318
                state = 319
			}
		}

		complete_effect = {
			set_cosmetic_tag = hispaniola 
			
			IF =  {
				limit = {
					NOT = {
						319 = {
							is_core_of = ROOT
						}
					}
				}
				319 = { add_claim_by = ROOT }
			}
			
			IF =  {
				limit = {
					NOT = {
						318 = {
							is_core_of = ROOT
						}
					}
				}
				318 = { add_claim_by = ROOT }
			}

			hidden_effect = {
				set_global_flag = hispaniola_flag

				news_event = { 
					id = south_american_news.6
					days = 1
					random_days = 2
				}

			}
			add_political_power = -50

			add_ideas = generic_recent_political_unification
			add_ideas = generic_recent_army_unification
			add_ideas = generic_recent_economic_unification

		}

		ai_will_do = {
			factor = 2000
		}
	}
}

peru_bolivia_category = {
	
	reunite_peru_bolivia = { 

		icon = generic_form_nation

		allowed = {
			OR = {
				original_tag = BOL # Bolivia
				original_tag = PRU # Peru
			}
		}

		available = {

			if = {
				limit = {
					original_tag = PRU 
				}
				NOT = { 
					has_country_flag = formed_peru_bolivia
					has_country_flag = PRU_no_peru_bolivia
					has_country_flag = PRU_no_inca_peru_bolivia
				}
			}
			
			# Loreto
			491 = {
				is_owned_and_controlled_by = ROOT
			}

			# Lima
			303 = {
				is_owned_and_controlled_by = ROOT
			}

			# Ucayali
			494 = {
				is_owned_and_controlled_by = ROOT
			}

			# Arequipa
			492 = {
				is_owned_and_controlled_by = ROOT
			}

			# Santa Cruz
			487 = {
				is_owned_and_controlled_by = ROOT
			}

			# La Paz
			302 = {
				is_owned_and_controlled_by = ROOT
			}

			# Tacna
			1061 = {
				is_owned_and_controlled_by = ROOT
			}

			OR = {
				AND = {
					original_tag = BOL
					PRU = {
						exists = no
					}
				}
				AND = {
					original_tag = PRU
					BOL = {
						exists = no
					}
				}
			}

		}

		visible = {
			OR = {
				original_tag = BOL # Bolivia
				original_tag = PRU # Peru
			}
			
			NOT = { has_global_flag = peru_bolivia_revived_flag }
			
		}

		complete_effect = {
			set_cosmetic_tag = peru_bolivian_confederation 
			
			IF =  {
				limit = {
					NOT = {
						491 = {
							is_core_of = ROOT
						}
					}
				}
				491 = { add_claim_by = ROOT }
			}
			
			IF =  {
				limit = {
					NOT = {
						303 = {
							is_core_of = ROOT
						}
					}
				}
				303 = { add_claim_by = ROOT }
			}

			IF =  {
				limit = {
					NOT = {
						494 = {
							is_core_of = ROOT
						}
					}
				}
				494 = { add_claim_by = ROOT }
			}

			IF =  {
				limit = {
					NOT = {
						492 = {
							is_core_of = ROOT
						}
					}
				}
				492 = { add_claim_by = ROOT }
			}

			IF =  {
				limit = {
					NOT = {
						487 = {
							is_core_of = ROOT
						}
					}
				}
				487 = { add_claim_by = ROOT }
			}

			IF =  {
				limit = {
					NOT = {
						1077 = {
							is_core_of = ROOT
						}
					}
				}
				1077 = { add_claim_by = ROOT }
			}

			IF =  {
				limit = {
					NOT = {
						302 = {
							is_core_of = ROOT
						}
					}
				}
				302 = { add_claim_by = ROOT }
			}

			IF =  {
				limit = {
					NOT = {
						490 = {
							is_core_of = ROOT
						}
					}
				}
				490 = { add_claim_by = ROOT }
			}

			IF =  {
				limit = {
					NOT = {
						688 = {
							is_core_of = ROOT
						}
					}
				}
				688 = { add_claim_by = ROOT }
			}

			IF =  {
				limit = {
					NOT = {
						506 = {
							is_core_of = ROOT
						}
					}
				}
				506 = { add_claim_by = ROOT }
			}

			IF =  {
				limit = {
					NOT = {
						1061 = {
							is_core_of = ROOT
						}
					}
				}
				1061 = { add_claim_by = ROOT }
			}

			IF =  {
				limit = {
					NOT = {
						1069 = {
							is_core_of = ROOT
						}
					}
				}
				1069 = { add_claim_by = ROOT }
			}

			IF =  {
				limit = {
					NOT = {
						1071 = {
							is_core_of = ROOT
						}
					}
				}
				1071 = { add_claim_by = ROOT }
			}

			IF =  {
				limit = {
					NOT = {
						1064 = {
							is_core_of = ROOT
						}
					}
				}
				1064 = { add_claim_by = ROOT }
			}

			IF =  {
				limit = {
					NOT = {
						1052 = {
							is_core_of = ROOT
						}
					}
				}
				1052 = { add_claim_by = ROOT }
			}

			IF =  {
				limit = {
					NOT = {
						1058 = {
							is_core_of = ROOT
						}
					}
				}
				1058 = { add_claim_by = ROOT }
			}

			add_ideas = generic_recent_political_unification
			add_ideas = generic_recent_army_unification
			add_ideas = generic_recent_economic_unification			

			hidden_effect = {
				set_global_flag = peru_bolivia_revived_flag

				news_event = { 
					id = south_american_news.5
					days = 1
					random_days = 2
				}
			}
		}

		ai_will_do = {
			factor = 2000
		}
	}

	peruvian_bolivian_joint_command = {
		icon = generic_form_nation

		allowed = {
			OR = {
				original_tag = BOL # Bolivia
				original_tag = PRU # Peru
			}
		}

		visible = {
			has_global_flag = peru_bolivia_revived_flag 
			NOT = { has_global_flag = peru_bolivia_generals }
		}
        complete_effect = {	
            if = {
            	limit = {
                   original_tag = PRU 
                }
                BOL = {
                    every_character = {
                        set_nationality = ROOT 
                    }
                }   
            }
			if = {
            	limit = {
                	original_tag = BOL 
                }
				PRU = {
					every_character = {
					set_nationality = ROOT 
					}
				}   
			}
			hidden_effect = {
				set_global_flag = peru_bolivia_generals 
			}	 
		}
        

		ai_will_do = {
			factor = 2000
		}	
	}
}

guianas_category = {
	
	unite_guiana = { 

		icon = generic_form_nation

		allowed = {
			OR = {
				original_tag = GYA
				original_tag = SUR
				original_tag = CAY
			}
		}

		available = {
			
			309 = {
				is_controlled_by = ROOT
			}

			310 = {
				is_controlled_by = ROOT
			}

			687 = {
				is_controlled_by = ROOT
			}

		}

		visible = {
			OR = {
				original_tag = GYA # Guyana
				original_tag = SUR # Suriname
				original_tag = CAY # Cayenne
			}
			
			NOT = { has_global_flag = guiana_flag }
			
		}

		complete_effect = {
			set_cosmetic_tag = united_guiana 
			
			# Suriname
			IF =  {
				limit = {
					NOT = {
						309 = {
							is_core_of = ROOT
						}
					}
				}
				309 = { 
					add_claim_by = ROOT 
					transfer_state_to = ROOT
				}
			}
			
			# French Guyana
			IF =  {
				limit = {
					NOT = {
						310 = {
							is_core_of = ROOT
						}
					}
				}
				310 = { 
					add_claim_by = ROOT 
					transfer_state_to = ROOT
				}
			}

			# British Guyana
			IF =  {
				limit = {
					NOT = {
						687 = {
							is_core_of = ROOT
						}
					}
				}
				687 = { 
					add_claim_by = ROOT 
					transfer_state_to = ROOT
				}
			}

			# Bolivar
			IF =  {
				limit = {
					NOT = {
						488 = {
							is_core_of = ROOT
						}
					}
				}
				488 = { add_claim_by = ROOT }
			}

			# Amazonas del Norte
			IF =  {
				limit = {
					NOT = {
						1073 = {
							is_core_of = ROOT
						}
					}
				}
				1073 = { add_claim_by = ROOT }
			}

			# Rio Branco - Amapa
			IF =  {
				limit = {
					NOT = {
						1056 = {
							is_core_of = ROOT
						}
					}
				}
				1056 = { add_claim_by = ROOT }
			}

			add_ideas = generic_recent_political_unification
			add_ideas = generic_recent_army_unification
			add_ideas = generic_recent_economic_unification			

			hidden_effect = {
				set_global_flag = guiana_flag

				news_event = { 
					id = south_american_news.7
					days = 1
					random_days = 2
				}
			}
		}

		ai_will_do = {
			factor = 2000
		}
	}
}