# Scripted localisation for the Naval College.
# Picks the right loc key based on the active training id / phase, so the
# main window's "doctrine slot" can show the trained subdoctrine the way
# vanilla shows the picked subdoctrine in the doctrine view.

# Active training name - shown in the green text bar of the doctrine slot.
defined_text = {
	name = GetNcActiveTrainingName
	text = {
		trigger = { check_variable = { nc_training_id = 1 } }
		localization_key = NC_TRAINING_T1_SUBMARINE_STUDIES_NAME_SHORT
	}
	text = {
		trigger = { check_variable = { nc_training_id = 2 } }
		localization_key = NC_TRAINING_T1_SCREEN_STUDIES_NAME_SHORT
	}
	text = {
		trigger = { check_variable = { nc_training_id = 3 } }
		localization_key = NC_TRAINING_T1_CARRIER_STUDIES_NAME_SHORT
	}
	text = {
		trigger = { check_variable = { nc_training_id = 4 } }
		localization_key = NC_TRAINING_T1_BATTLESHIP_STUDIES_NAME_SHORT
	}
	# Fallback for any unmapped id - keeps the slot from rendering "[broken]"
	text = {
		localization_key = NC_TRAINING_NONE
	}
}

# Cost line for the next Advance click. Three of these - one per phase
# transition - branched by nc_training_id so the right convoy/ship payment
# is shown for each training. Used by the per-phase info textboxes.

# Phase 0 -> 1 cost
defined_text = {
	name = GetNcCostP1
	text = {
		trigger = { check_variable = { nc_training_id = 1 } }
		localization_key = NC_COST_T1_SUBMARINE_P1
	}
	text = {
		trigger = { check_variable = { nc_training_id = 2 } }
		localization_key = NC_COST_T1_SCREEN_P1
	}
	text = {
		trigger = { check_variable = { nc_training_id = 3 } }
		localization_key = NC_COST_T1_CARRIER_P1
	}
	text = {
		trigger = { check_variable = { nc_training_id = 4 } }
		localization_key = NC_COST_T1_BATTLESHIP_P1
	}
	text = {
		localization_key = NC_COST_NONE
	}
}

# Phase 1 -> 2 cost
defined_text = {
	name = GetNcCostP2
	text = {
		trigger = { check_variable = { nc_training_id = 1 } }
		localization_key = NC_COST_T1_SUBMARINE_P2
	}
	text = {
		trigger = { check_variable = { nc_training_id = 2 } }
		localization_key = NC_COST_T1_SCREEN_P2
	}
	text = {
		trigger = { check_variable = { nc_training_id = 3 } }
		localization_key = NC_COST_T1_CARRIER_P2
	}
	text = {
		trigger = { check_variable = { nc_training_id = 4 } }
		localization_key = NC_COST_T1_BATTLESHIP_P2
	}
	text = {
		localization_key = NC_COST_NONE
	}
}

# Phase 2 -> 3 cost (final advance click)
defined_text = {
	name = GetNcCostP3
	text = {
		trigger = { check_variable = { nc_training_id = 1 } }
		localization_key = NC_COST_T1_SUBMARINE_P3
	}
	text = {
		trigger = { check_variable = { nc_training_id = 2 } }
		localization_key = NC_COST_T1_SCREEN_P3
	}
	text = {
		trigger = { check_variable = { nc_training_id = 3 } }
		localization_key = NC_COST_T1_CARRIER_P3
	}
	text = {
		trigger = { check_variable = { nc_training_id = 4 } }
		localization_key = NC_COST_T1_BATTLESHIP_P3
	}
	text = {
		localization_key = NC_COST_NONE
	}
}

# Phase pill text ("1/3", "2/3", "3/3") - shown next to the icon.
defined_text = {
	name = GetNcPhasePill
	text = {
		trigger = { check_variable = { nc_training_phase = 0 } }
		localization_key = NC_PHASE_PILL_0
	}
	text = {
		trigger = { check_variable = { nc_training_phase = 1 } }
		localization_key = NC_PHASE_PILL_1
	}
	text = {
		trigger = { check_variable = { nc_training_phase = 2 } }
		localization_key = NC_PHASE_PILL_2
	}
	text = {
		trigger = { check_variable = { nc_training_phase = 3 } }
		localization_key = NC_PHASE_PILL_3
	}
	text = {
		localization_key = NC_PHASE_PILL_0
	}
}

# ============================================================
# TRAINING PICKER ROW - tier-aware names + descriptions
# Each picker row's text dispatches through one of these so the
# label and mastery line reflect the current academy tier (which
# is bumped by the Tier ↑ academy upgrade). Without this, the
# picker would always show "(T1) ... +base mastery" even after
# the player upgrades the track to T2/T3.
# ============================================================
defined_text = {
	name = GetNcSubmarineStudiesName
	text = {
		trigger = { check_variable = { nc_submarine_tier = 3 } }
		localization_key = NC_TRAINING_SUBMARINE_NAME_T3
	}
	text = {
		trigger = { check_variable = { nc_submarine_tier = 2 } }
		localization_key = NC_TRAINING_SUBMARINE_NAME_T2
	}
	text = {
		localization_key = NC_TRAINING_SUBMARINE_NAME_T1
	}
}
defined_text = {
	name = GetNcSubmarineStudiesDesc
	text = {
		trigger = { check_variable = { nc_submarine_tier = 3 } }
		localization_key = NC_TRAINING_SUBMARINE_DESC_T3
	}
	text = {
		trigger = { check_variable = { nc_submarine_tier = 2 } }
		localization_key = NC_TRAINING_SUBMARINE_DESC_T2
	}
	text = {
		localization_key = NC_TRAINING_SUBMARINE_DESC_T1
	}
}

defined_text = {
	name = GetNcScreenStudiesName
	text = {
		trigger = { check_variable = { nc_screen_tier = 3 } }
		localization_key = NC_TRAINING_SCREEN_NAME_T3
	}
	text = {
		trigger = { check_variable = { nc_screen_tier = 2 } }
		localization_key = NC_TRAINING_SCREEN_NAME_T2
	}
	text = {
		localization_key = NC_TRAINING_SCREEN_NAME_T1
	}
}
defined_text = {
	name = GetNcScreenStudiesDesc
	text = {
		trigger = { check_variable = { nc_screen_tier = 3 } }
		localization_key = NC_TRAINING_SCREEN_DESC_T3
	}
	text = {
		trigger = { check_variable = { nc_screen_tier = 2 } }
		localization_key = NC_TRAINING_SCREEN_DESC_T2
	}
	text = {
		localization_key = NC_TRAINING_SCREEN_DESC_T1
	}
}

defined_text = {
	name = GetNcCarrierStudiesName
	text = {
		trigger = { check_variable = { nc_carrier_tier = 3 } }
		localization_key = NC_TRAINING_CARRIER_NAME_T3
	}
	text = {
		trigger = { check_variable = { nc_carrier_tier = 2 } }
		localization_key = NC_TRAINING_CARRIER_NAME_T2
	}
	text = {
		localization_key = NC_TRAINING_CARRIER_NAME_T1
	}
}
defined_text = {
	name = GetNcCarrierStudiesDesc
	text = {
		trigger = { check_variable = { nc_carrier_tier = 3 } }
		localization_key = NC_TRAINING_CARRIER_DESC_T3
	}
	text = {
		trigger = { check_variable = { nc_carrier_tier = 2 } }
		localization_key = NC_TRAINING_CARRIER_DESC_T2
	}
	text = {
		localization_key = NC_TRAINING_CARRIER_DESC_T1
	}
}

defined_text = {
	name = GetNcBattleshipStudiesName
	text = {
		trigger = { check_variable = { nc_battleship_tier = 3 } }
		localization_key = NC_TRAINING_BATTLESHIP_NAME_T3
	}
	text = {
		trigger = { check_variable = { nc_battleship_tier = 2 } }
		localization_key = NC_TRAINING_BATTLESHIP_NAME_T2
	}
	text = {
		localization_key = NC_TRAINING_BATTLESHIP_NAME_T1
	}
}
defined_text = {
	name = GetNcBattleshipStudiesDesc
	text = {
		trigger = { check_variable = { nc_battleship_tier = 3 } }
		localization_key = NC_TRAINING_BATTLESHIP_DESC_T3
	}
	text = {
		trigger = { check_variable = { nc_battleship_tier = 2 } }
		localization_key = NC_TRAINING_BATTLESHIP_DESC_T2
	}
	text = {
		localization_key = NC_TRAINING_BATTLESHIP_DESC_T1
	}
}

defined_text = {
	name = GetNcTrainingIcon
	text = {
		trigger = { check_variable = { nc_training_id = 1 } }
		localization_key = "GFX_doctrine_trade_interdiction_medium"
	}
	text = {
		trigger = { check_variable = { nc_training_id = 2 } }
		localization_key = "GFX_doctrine_convoy_escorts_medium"
	}
	text = {
		trigger = { check_variable = { nc_training_id = 3 } }
		localization_key = "GFX_doctrine_base_strike_medium"
	}
	text = {
		trigger = { check_variable = { nc_training_id = 4 } }
		localization_key = "GFX_doctrine_fleet_in_being_medium"
	}
	text = {
		localization_key = "GFX_doctrine_fleet_in_being_medium"
	}
}

# ============================================================
# ACADEMY SCRIPTED LOCALISATION
# ============================================================

# Headmaster slot label - either the assigned character's name or
# a "Click to assign" placeholder. var: dereferences the country
# variable holding the character ref; .GetName resolves the name.
defined_text = {
	name = GetNcHeadmasterName
	text = {
		trigger = { has_variable = nc_headmaster_id }
		localization_key = "[?nc_headmaster_id.GetName]"
	}
	text = {
		localization_key = NC_ACADEMY_SLOT_EMPTY
	}
}

defined_text = {
	name = GetNcOfficer1Name
	text = {
		trigger = { has_variable = nc_officer_1_id }
		localization_key = "[?nc_officer_1_id.GetName]"
	}
	text = {
		localization_key = NC_ACADEMY_SLOT_EMPTY
	}
}
defined_text = {
	name = GetNcOfficer2Name
	text = {
		trigger = { has_variable = nc_officer_2_id }
		localization_key = "[?nc_officer_2_id.GetName]"
	}
	text = {
		localization_key = NC_ACADEMY_SLOT_EMPTY
	}
}
defined_text = {
	name = GetNcOfficer3Name
	text = {
		trigger = { has_variable = nc_officer_3_id }
		localization_key = "[?nc_officer_3_id.GetName]"
	}
	text = {
		localization_key = NC_ACADEMY_SLOT_EMPTY
	}
}

# Per-track row label. Shows the training name + current tier.
# Tier label values come from the nc_<track>_tier variable, which
# is initialised to 1 by nc_academy_init_defaults_effect.
defined_text = {
	name = GetNcAcademySubmarineRowLabel
	text = {
		trigger = { check_variable = { nc_submarine_tier = 3 } }
		localization_key = NC_ACADEMY_ROW_SUB_T3
	}
	text = {
		trigger = { check_variable = { nc_submarine_tier = 2 } }
		localization_key = NC_ACADEMY_ROW_SUB_T2
	}
	text = {
		localization_key = NC_ACADEMY_ROW_SUB_T1
	}
}
defined_text = {
	name = GetNcAcademyScreenRowLabel
	text = {
		trigger = { check_variable = { nc_screen_tier = 3 } }
		localization_key = NC_ACADEMY_ROW_SCR_T3
	}
	text = {
		trigger = { check_variable = { nc_screen_tier = 2 } }
		localization_key = NC_ACADEMY_ROW_SCR_T2
	}
	text = {
		localization_key = NC_ACADEMY_ROW_SCR_T1
	}
}
defined_text = {
	name = GetNcAcademyCarrierRowLabel
	text = {
		trigger = { check_variable = { nc_carrier_tier = 3 } }
		localization_key = NC_ACADEMY_ROW_CAR_T3
	}
	text = {
		trigger = { check_variable = { nc_carrier_tier = 2 } }
		localization_key = NC_ACADEMY_ROW_CAR_T2
	}
	text = {
		localization_key = NC_ACADEMY_ROW_CAR_T1
	}
}
defined_text = {
	name = GetNcAcademyBattleshipRowLabel
	text = {
		trigger = { check_variable = { nc_battleship_tier = 3 } }
		localization_key = NC_ACADEMY_ROW_BB_T3
	}
	text = {
		trigger = { check_variable = { nc_battleship_tier = 2 } }
		localization_key = NC_ACADEMY_ROW_BB_T2
	}
	text = {
		localization_key = NC_ACADEMY_ROW_BB_T1
	}
}

# Active upgrade banner - which upgrade is running, days left.
# Each branch maps an upgrade id to a localised name.
defined_text = {
	name = GetNcActiveUpgradeName
	text = {
		trigger = { check_variable = { nc_active_upgrade_id = 1 } }
		localization_key = NC_UPGRADE_NAME_SUB_TIER
	}
	text = {
		trigger = { check_variable = { nc_active_upgrade_id = 4 } }
		localization_key = NC_UPGRADE_NAME_SCR_TIER
	}
	text = {
		trigger = { check_variable = { nc_active_upgrade_id = 7 } }
		localization_key = NC_UPGRADE_NAME_CAR_TIER
	}
	text = {
		trigger = { check_variable = { nc_active_upgrade_id = 10 } }
		localization_key = NC_UPGRADE_NAME_BB_TIER
	}
	text = {
		trigger = { check_variable = { nc_active_upgrade_id = 13 } }
		localization_key = NC_UPGRADE_NAME_UNLOCK_SLOTS
	}
	text = {
		trigger = { check_variable = { nc_active_upgrade_id = 14 } }
		localization_key = NC_UPGRADE_NAME_UNLOCK_SPIRIT
	}
	text = {
		trigger = { check_variable = { nc_active_upgrade_id = 15 } }
		localization_key = NC_UPGRADE_NAME_UNLOCK_THEORIST
	}
	text = {
		trigger = { check_variable = { nc_active_upgrade_id = 16 } }
		localization_key = NC_UPGRADE_NAME_SPEED
	}
	text = {
		localization_key = NC_UPGRADE_NAME_NONE
	}
}

# Stats summary - one big multi-line string built by chaining
# scripted-loc fragments. Each fragment is gated on its variable;
# when not unlocked the fragment returns the "locked" loc string.
defined_text = {
	name = GetNcAcademyStatsText
	text = {
		localization_key = NC_ACADEMY_STATS_BODY
	}
}

# Per-fragment helpers consumed by NC_ACADEMY_STATS_BODY's
# interpolated calls.
defined_text = {
	name = GetNcAcademyStatsSpirit
	text = {
		trigger = { check_variable = { nc_academy_spirit_unlocked = 1 } }
		localization_key = NC_ACADEMY_STATS_SPIRIT_ON
	}
	text = {
		localization_key = NC_ACADEMY_STATS_SPIRIT_OFF
	}
}
defined_text = {
	name = GetNcAcademyStatsTheorist
	text = {
		trigger = { check_variable = { nc_academy_theorist_unlocked = 1 } }
		localization_key = NC_ACADEMY_STATS_THEORIST_ON
	}
	text = {
		localization_key = NC_ACADEMY_STATS_THEORIST_OFF
	}
}
defined_text = {
	name = GetNcAcademyStatsSlots
	text = {
		trigger = { check_variable = { nc_academy_slots_unlocked = 1 } }
		localization_key = NC_ACADEMY_STATS_SLOTS_ON
	}
	text = {
		localization_key = NC_ACADEMY_STATS_SLOTS_OFF
	}
}
defined_text = {
	name = GetNcAcademyStatsSpeed
	text = {
		trigger = { check_variable = { nc_academy_speed_level = 3 } }
		localization_key = NC_ACADEMY_STATS_SPEED_3
	}
	text = {
		trigger = { check_variable = { nc_academy_speed_level = 2 } }
		localization_key = NC_ACADEMY_STATS_SPEED_2
	}
	text = {
		trigger = { check_variable = { nc_academy_speed_level = 1 } }
		localization_key = NC_ACADEMY_STATS_SPEED_1
	}
	text = {
		localization_key = NC_ACADEMY_STATS_SPEED_0
	}
}
