###################################
# Unclaimed Territories Mechanics #
###################################
defined_text = {
  name = UCT_territory_management_establish_first_claim_4_desc_scripted
  text = {
    trigger = { 
		OR = {
			AND = {
				FROM = { has_state_flag = UCT_territory_management_claim_progress_convoy_3_flag }
				has_equipment = { convoy_1 < 3 }
			}
			AND = {
				FROM = { has_state_flag = UCT_territory_management_claim_progress_convoy_2_flag }
				has_equipment = { convoy_1 < 2 }
			}
			AND = {
				FROM = { has_state_flag = UCT_territory_management_claim_progress_convoy_1_flag }
				has_equipment = { convoy_1 < 1 }
			}
		}
	}
    localization_key = UCT_territory_management_establish_first_claim_4_desc_convoy_loc
  }
  text = {
    trigger = { 
		FROM = { check_variable = { var = UCT_territory_management_claim_progress_var value = 100 compare = equals } }
	}
    localization_key = UCT_territory_management_establish_first_claim_4_desc_done_loc
  }
  text = {
    trigger = { 
		always = yes
	}
    localization_key = UCT_territory_management_establish_first_claim_4_desc_loc
  }
}
defined_text = {
  name = UCT_territory_management_establish_first_claim_4_scripted
  text = {
    trigger = { 
		OR = {
			AND = {
				FROM = { has_state_flag = UCT_territory_management_claim_progress_convoy_3_flag }
				has_equipment = { convoy_1 < 3 }
			}
			AND = {
				FROM = { has_state_flag = UCT_territory_management_claim_progress_convoy_2_flag }
				has_equipment = { convoy_1 < 2 }
			}
			AND = {
				FROM = { has_state_flag = UCT_territory_management_claim_progress_convoy_1_flag }
				has_equipment = { convoy_1 < 1 }
			}
		}
	}
    localization_key = UCT_territory_management_establish_first_claim_4_title_convoy_loc
  }
  text = {
    trigger = { 
		FROM = { check_variable = { var = UCT_territory_management_claim_progress_var value = 100 compare = equals } }
	}
    localization_key = UCT_territory_management_establish_first_claim_4_title_done_loc
  }
  text = {
    trigger = { 
		always = yes
	}
    localization_key = UCT_territory_management_establish_first_claim_4_title_loc
  }
}
defined_text = {
  name = UCT_territory_management_colonization_progress_scripted
  text = {
    trigger = { 
		THIS = { check_variable = { var = UCT_territory_management_colonization_progress_var value = 0 compare = equals } }
	}
    localization_key = UCT_territory_management_colonization_progress_none_loc
  }
  text = {
    trigger = { 
		THIS = { check_variable = { var = UCT_territory_management_colonization_progress_var value = 50 compare = less_than } }
	}
    localization_key = UCT_territory_management_colonization_progress_low_loc
  }
  text = {
    trigger = { 
		THIS = { check_variable = { var = UCT_territory_management_colonization_progress_var value = 50 compare = greater_than } }
	}
    localization_key = UCT_territory_management_colonization_progress_high_loc
  }
}
defined_text = {
  name = UCT_territory_management_population_scripted
  text = {
    trigger = { 
		THIS = { state_population < 1000 }
	}
    localization_key = UCT_territory_management_population_insignificant_loc
  }
  text = {
    trigger = { always = yes }
    localization_key = UCT_territory_management_population_loc
  }
}
defined_text = {
  name = UCT_territory_management_claimed_by_scripted
  text = {
    trigger = { 
		THIS = { has_variable = UCT_territory_management_claimed_by_var }
	}
    localization_key = UCT_territory_management_claimed_by_var_loc
  }
  text = {
    trigger = { always = yes }
    localization_key = UCT_territory_management_claimed_by_nobody_loc
  }
}
defined_text = {
  name = UCT_territory_management_claim_progress_scripted
  text = {
    trigger = { 
		THIS = { check_variable = { var = UCT_territory_management_claim_progress_var value = 0 compare = equals } }
	}
    localization_key = UCT_territory_management_claim_progress_none_loc
  }
  text = {
    trigger = { 
		THIS = { check_variable = { var = UCT_territory_management_claim_progress_var value = 50 compare = less_than } }
	}
    localization_key = UCT_territory_management_claim_progress_low_loc
  }
  text = {
    trigger = { 
		THIS = { check_variable = { var = UCT_territory_management_claim_progress_var value = 50 compare = greater_than } }
	}
    localization_key = UCT_territory_management_claim_progress_high_loc
  }
}
defined_text = {
  name = UCT_territory_management_claim_status_scripted
  text = {
    trigger = { 
		THIS = { check_variable = { var = UCT_territory_management_num_of_claims_var value = 0 compare = equals } }
	}
    localization_key = UCT_territory_management_claim_status_unclaimed_loc
  }
  text = {
    trigger = { 
		THIS = { check_variable = { var = UCT_territory_management_num_of_claims_var value = 1 compare = equals } }
	}
    localization_key = UCT_territory_management_claim_status_uncontested_loc
  }
  text = {
    trigger = { 
		THIS = { check_variable = { var = UCT_territory_management_num_of_claims_var value = 1 compare = greater_than } }
		THIS = { check_variable = { var = UCT_territory_management_claim_progress_var value = 100 compare = less_than } }
	}
    localization_key = UCT_territory_management_claim_status_contested_loc
  }
  text = {
    trigger = { 
		THIS = { check_variable = { var = UCT_territory_management_num_of_claims_var value = 1 compare = greater_than } }
		THIS = { check_variable = { var = UCT_territory_management_claim_progress_var value = 100 compare = greater_than_or_equals } }
	}
    localization_key = UCT_territory_management_claim_status_disputed_loc
  }
}

defined_text = { # colonial techs
	name = GetColonialTechUnlocked
	text = {
		trigger = {
			AND={ 
				has_tech = tech_humanities_colonial_stock_brokering
				has_tech = tech_humanities_african_warfare
			}
		}
		localization_key = tech_humanities_african_warfare_colonial_stock_brokering_effect
	}
	text = {
		trigger = {
			has_tech = tech_humanities_colonial_stock_brokering
		}
		localization_key = tech_humanities_colonial_stock_brokering_effect
	}
	text = {
		trigger = {
			has_tech = tech_humanities_african_warfare
		}
		localization_key = tech_humanities_african_warfare_effect
	}
	text = {
		#localization_key = GER_KDF_WAGEN_NAME
		#localization_key = tech_humanities_colonial_stock_brokering_effect
	}
}

defined_text = { # colonial techs
	name = GetColonizationCost
	text = {
		trigger = {
			FROM={
				OR={
					is_claimed_by = ROOT
					any_country={
						is_puppet_of = ROOT
						OR={
							FROM = {is_core_of = PREV}
							FROM = {is_claimed_by = PREV}
						}
					}
				}			
			}
		}
		localization_key = GetColonizationCostClaim
	}
	text = {
		trigger = {
			NOT={
				FROM={
					OR={
						is_claimed_by = ROOT
						any_country={
							is_puppet_of = ROOT
							OR={
								FROM = {is_core_of = PREV}
								FROM = {is_claimed_by = PREV}
							}
						}
					}			
				}
			}
		}
		localization_key = GetColonizationCostNoClaim
	}
}

defined_text = { # suez construction
	name = GetSuezConstructionAvailible
	text = {
		trigger = {
			EGY={has_country_flag = suez_constructor_flag}
			check_variable = {
				var = EGY.suez_progress
				value = EGY.suez_progress_max
				compare = greater_than_or_equals
			}
		}
		localization_key = "GetSuezConstructionAvailibleComplete"
	}
	text = {
		trigger = {
			EGY={has_country_flag = suez_constructor_flag}
			EGY={
				check_variable = {
					var = suez_progress
					value = suez_progress_max
					compare = less_than
				}
			}
		}
		localization_key = "GetSuezConstructionAvailibleYes"
	}
	text = {
		trigger = {
			NOT={EGY={has_country_flag = suez_constructor_flag}}
		}
		localization_key = "GetSuezConstructionAvailibleNO"
	}
	
}

defined_text = { # suez status
	name = GetSuezCurrentStatus
	text = {
		trigger = {
			NOT={
				has_global_flag = SUEZ_CANAL_BLOCKED
			}
		}
		localization_key = "GetSuezCurrentStatusOpen"
	}
	text = {
		trigger = {
			has_global_flag = SUEZ_CANAL_BLOCKED
		}
		localization_key = "GetSuezCurrentStatusBlocked"
	}
	
}
defined_text = { # current region being voted on by the berlin conferance
	name = GetCurrentberVotingRegion
	text = {
		localization_key = "Mauritania"
		trigger = {
			check_variable = {UCT.current_region_conferance_vote = 1}
		}
	}
	text = {
		localization_key = "Senegal"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 2} }
		}
	}
	text = {
		localization_key = "Guinea"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 3} }
		}
	}
	text = {
		localization_key = "Sierra Leone"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 4} }
		}
	}
	text = {
		localization_key = "Ivory Coast"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 5} }
		}
	}
	text = {
		localization_key = "Ghana"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 6} }
		}
	}
	text = {
		localization_key = "Togo"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 7} }
		}
	}
	text = {
		localization_key = "Benin"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 8} }
		}
	}
	text = {
		localization_key = "Nigeria"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 9} }
		}
	}
	text = {
		localization_key = "Equatorial Africa"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 10} }
		}
	}
	text = {
		localization_key = "Gabon"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 11} }
		}
	}
	text = {
		localization_key = "Congo"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 12} }
		}
	}
	text = {
		localization_key = "Angola"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 13} }
		}
	}
	text = {
		localization_key = "Nambia"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 14} }
		}
	}
	text = {
		localization_key = "Tanganyika"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 15} }
		}
	}
	text = {
		localization_key = "Kenya"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 16} }
		}
	}
	text = {
		localization_key = "African Horn"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 17} }
		}
	}
	
	text = {
		localization_key = "Uganda"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 18} }
		}
	}
	text = {
		localization_key = "Rhodesia"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 19} }
		}
	}
	text = {
		localization_key = "Central Africa"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 20} }
		}
	}
	text = {
		localization_key = "Mali"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 21} }
		}
	}
	text = {
		localization_key = "Niger"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 22} }
		}
	}
	text = {
		localization_key = "Burkina Faso"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 23} }
		}
	}
	text = {
		localization_key = "Chad"
		trigger = {
			UCT = { check_variable = {current_region_conferance_vote = 24} }
		}
	}
	text = {
		localization_key = "ERROR: cannot get region"
	}
	
}


defined_text = {
    name = GetTotalPopulation
    text = {
        trigger = {
            check_variable = { global.population_array^score_array_position_var_real > 1000 }
        }
        localization_key = POPULATION_BILLIONS_FORMAT
    }
    text = {
        trigger = {
            check_variable = { global.population_array^score_array_position_var_real > 1 }
        }
        localization_key = POPULATION_MILLIONS_FORMAT
    }
    text = {
        trigger = {
            check_variable = { max_manpower_k > 1 }
        }
        localization_key = POPULATION_THOUSANDS_FORMAT
    }
    text = {
        localization_key = POPULATION_BASE_FORMAT
    }
}

defined_text = { # army funding
	name = GetQNGArmybalance
	text = {
		trigger={
			check_variable = { QNG_army_funding_level_lp > 0 }
		}
		#set_temp_variable = {doesthiswork = 1}
		localization_key = "Overfunding"
	}
	text = {
		trigger={
			check_variable = { QNG_army_funding_level_lp < 0 }
		}
		localization_key = "Underfunded"
	}
	text = {
		localization_key = "Funded"
	}
}

defined_text = { # whether oman has reformed or not
	name = GetOmanMacReforms
	text = {
		trigger={
			has_country_flag = OMA_western
		}
		localization_key = "Continue the Reforms"
	}
	text = {
		localization_key = "Begin Reforms"
	}
}
defined_text = { # whether oman has reformed or not
	name = GetOmanMacIsolated
	text = {
		trigger={
			has_country_flag=OMA_isolation
		}
		localization_key = "Remaining Isolated"
	}
	text = {
		localization_key = "Retreat into Obscurity"
	}
}
