# Scripted localisation for the War 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 = GetWcActiveTrainingName
	text = {
		trigger = { check_variable = { wc_training_id = 1 } }
		localization_key = WC_TRAINING_T1_INFANTRY_STUDIES_NAME_SHORT
	}
	text = {
		trigger = { check_variable = { wc_training_id = 2 } }
		localization_key = WC_TRAINING_T1_ARTILLERY_SUPPORT_STUDIES_NAME_SHORT
	}
	text = {
		trigger = { check_variable = { wc_training_id = 3 } }
		localization_key = WC_TRAINING_T1_ARMOR_STUDIES_NAME_SHORT
	}
	text = {
		trigger = { check_variable = { wc_training_id = 4 } }
		localization_key = WC_TRAINING_T1_OPERATIONAL_STUDIES_NAME_SHORT
	}
	# Fallback for any unmapped id - keeps the slot from rendering "[broken]"
	text = {
		localization_key = WC_TRAINING_NONE
	}
}

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

# Phase 0 -> 1 cost
defined_text = {
	name = GetWcCostP1
	text = {
		trigger = { check_variable = { wc_training_id = 1 } }
		localization_key = WC_COST_T1_INFANTRY_P1
	}
	text = {
		trigger = { check_variable = { wc_training_id = 2 } }
		localization_key = WC_COST_T1_ARTILLERY_P1
	}
	text = {
		trigger = { check_variable = { wc_training_id = 3 } }
		localization_key = WC_COST_T1_ARMOR_P1
	}
	text = {
		trigger = { check_variable = { wc_training_id = 4 } }
		localization_key = WC_COST_T1_OPERATIONAL_P1
	}
	text = {
		localization_key = WC_COST_NONE
	}
}

# Phase 1 -> 2 cost
defined_text = {
	name = GetWcCostP2
	text = {
		trigger = { check_variable = { wc_training_id = 1 } }
		localization_key = WC_COST_T1_INFANTRY_P2
	}
	text = {
		trigger = { check_variable = { wc_training_id = 2 } }
		localization_key = WC_COST_T1_ARTILLERY_P2
	}
	text = {
		trigger = { check_variable = { wc_training_id = 3 } }
		localization_key = WC_COST_T1_ARMOR_P2
	}
	text = {
		trigger = { check_variable = { wc_training_id = 4 } }
		localization_key = WC_COST_T1_OPERATIONAL_P2
	}
	text = {
		localization_key = WC_COST_NONE
	}
}

# Phase 2 -> 3 cost (final advance click)
defined_text = {
	name = GetWcCostP3
	text = {
		trigger = { check_variable = { wc_training_id = 1 } }
		localization_key = WC_COST_T1_INFANTRY_P3
	}
	text = {
		trigger = { check_variable = { wc_training_id = 2 } }
		localization_key = WC_COST_T1_ARTILLERY_P3
	}
	text = {
		trigger = { check_variable = { wc_training_id = 3 } }
		localization_key = WC_COST_T1_ARMOR_P3
	}
	text = {
		trigger = { check_variable = { wc_training_id = 4 } }
		localization_key = WC_COST_T1_OPERATIONAL_P3
	}
	text = {
		localization_key = WC_COST_NONE
	}
}

# Phase pill text ("1/3", "2/3", "3/3") - shown next to the icon, mirroring
# the small XP/level badge vanilla puts next to a picked subdoctrine.
defined_text = {
	name = GetWcPhasePill
	text = {
		trigger = { check_variable = { wc_training_phase = 0 } }
		localization_key = WC_PHASE_PILL_0
	}
	text = {
		trigger = { check_variable = { wc_training_phase = 1 } }
		localization_key = WC_PHASE_PILL_1
	}
	text = {
		trigger = { check_variable = { wc_training_phase = 2 } }
		localization_key = WC_PHASE_PILL_2
	}
	text = {
		trigger = { check_variable = { wc_training_phase = 3 } }
		localization_key = WC_PHASE_PILL_3
	}
	text = {
		localization_key = WC_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) ... +0.032 mastery" even after
# the player upgrades the track to T2/T3.
# ============================================================
defined_text = {
	name = GetWcInfantryStudiesName
	text = {
		trigger = { check_variable = { wc_infantry_tier = 3 } }
		localization_key = WC_TRAINING_INFANTRY_NAME_T3
	}
	text = {
		trigger = { check_variable = { wc_infantry_tier = 2 } }
		localization_key = WC_TRAINING_INFANTRY_NAME_T2
	}
	text = {
		localization_key = WC_TRAINING_INFANTRY_NAME_T1
	}
}
defined_text = {
	name = GetWcInfantryStudiesDesc
	text = {
		trigger = { check_variable = { wc_infantry_tier = 3 } }
		localization_key = WC_TRAINING_INFANTRY_DESC_T3
	}
	text = {
		trigger = { check_variable = { wc_infantry_tier = 2 } }
		localization_key = WC_TRAINING_INFANTRY_DESC_T2
	}
	text = {
		localization_key = WC_TRAINING_INFANTRY_DESC_T1
	}
}

defined_text = {
	name = GetWcArtilleryStudiesName
	text = {
		trigger = { check_variable = { wc_artillery_tier = 3 } }
		localization_key = WC_TRAINING_ARTILLERY_NAME_T3
	}
	text = {
		trigger = { check_variable = { wc_artillery_tier = 2 } }
		localization_key = WC_TRAINING_ARTILLERY_NAME_T2
	}
	text = {
		localization_key = WC_TRAINING_ARTILLERY_NAME_T1
	}
}
defined_text = {
	name = GetWcArtilleryStudiesDesc
	text = {
		trigger = { check_variable = { wc_artillery_tier = 3 } }
		localization_key = WC_TRAINING_ARTILLERY_DESC_T3
	}
	text = {
		trigger = { check_variable = { wc_artillery_tier = 2 } }
		localization_key = WC_TRAINING_ARTILLERY_DESC_T2
	}
	text = {
		localization_key = WC_TRAINING_ARTILLERY_DESC_T1
	}
}

defined_text = {
	name = GetWcArmorStudiesName
	text = {
		trigger = { check_variable = { wc_armor_tier = 3 } }
		localization_key = WC_TRAINING_ARMOR_NAME_T3
	}
	text = {
		trigger = { check_variable = { wc_armor_tier = 2 } }
		localization_key = WC_TRAINING_ARMOR_NAME_T2
	}
	text = {
		localization_key = WC_TRAINING_ARMOR_NAME_T1
	}
}
defined_text = {
	name = GetWcArmorStudiesDesc
	text = {
		trigger = { check_variable = { wc_armor_tier = 3 } }
		localization_key = WC_TRAINING_ARMOR_DESC_T3
	}
	text = {
		trigger = { check_variable = { wc_armor_tier = 2 } }
		localization_key = WC_TRAINING_ARMOR_DESC_T2
	}
	text = {
		localization_key = WC_TRAINING_ARMOR_DESC_T1
	}
}

defined_text = {
	name = GetWcOperationalStudiesName
	text = {
		trigger = { check_variable = { wc_operational_tier = 3 } }
		localization_key = WC_TRAINING_OPERATIONAL_NAME_T3
	}
	text = {
		trigger = { check_variable = { wc_operational_tier = 2 } }
		localization_key = WC_TRAINING_OPERATIONAL_NAME_T2
	}
	text = {
		localization_key = WC_TRAINING_OPERATIONAL_NAME_T1
	}
}
defined_text = {
	name = GetWcOperationalStudiesDesc
	text = {
		trigger = { check_variable = { wc_operational_tier = 3 } }
		localization_key = WC_TRAINING_OPERATIONAL_DESC_T3
	}
	text = {
		trigger = { check_variable = { wc_operational_tier = 2 } }
		localization_key = WC_TRAINING_OPERATIONAL_DESC_T2
	}
	text = {
		localization_key = WC_TRAINING_OPERATIONAL_DESC_T1
	}
}

defined_text = {
	name = GetWcTrainingIcon
	text = {
		trigger = { check_variable = { wc_training_id = 1 } }
		localization_key = "GFX_doctrine_commandos_medium"
	}
	text = {
		trigger = { check_variable = { wc_training_id = 2 } }
		localization_key = "GFX_doctrine_superior_firepower_medium"
	}
	text = {
		trigger = { check_variable = { wc_training_id = 3 } }
		localization_key = "GFX_doctrine_armored_spearhead_medium"
	}
	text = {
		trigger = { check_variable = { wc_training_id = 4 } }
		localization_key = "GFX_doctrine_grand_battleplan_medium"
	}
	text = {
		localization_key = "GFX_doctrine_grand_battleplan_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 = GetWcHeadmasterName
	text = {
		trigger = { has_variable = wc_headmaster_id }
		localization_key = "[?wc_headmaster_id.GetName]"
	}
	text = {
		localization_key = WC_ACADEMY_SLOT_EMPTY
	}
}

defined_text = {
	name = GetWcOfficer1Name
	text = {
		trigger = { has_variable = wc_officer_1_id }
		localization_key = "[?wc_officer_1_id.GetName]"
	}
	text = {
		localization_key = WC_ACADEMY_SLOT_EMPTY
	}
}
defined_text = {
	name = GetWcOfficer2Name
	text = {
		trigger = { has_variable = wc_officer_2_id }
		localization_key = "[?wc_officer_2_id.GetName]"
	}
	text = {
		localization_key = WC_ACADEMY_SLOT_EMPTY
	}
}
defined_text = {
	name = GetWcOfficer3Name
	text = {
		trigger = { has_variable = wc_officer_3_id }
		localization_key = "[?wc_officer_3_id.GetName]"
	}
	text = {
		localization_key = WC_ACADEMY_SLOT_EMPTY
	}
}

# Per-track row label. Shows the training name + current tier.
# Tier label values come from the wc_<track>_tier variable, which
# is initialised to 1 by wc_academy_init_defaults_effect.
defined_text = {
	name = GetWcAcademyInfantryRowLabel
	text = {
		trigger = { check_variable = { wc_infantry_tier = 3 } }
		localization_key = WC_ACADEMY_ROW_INF_T3
	}
	text = {
		trigger = { check_variable = { wc_infantry_tier = 2 } }
		localization_key = WC_ACADEMY_ROW_INF_T2
	}
	text = {
		localization_key = WC_ACADEMY_ROW_INF_T1
	}
}
defined_text = {
	name = GetWcAcademyArtilleryRowLabel
	text = {
		trigger = { check_variable = { wc_artillery_tier = 3 } }
		localization_key = WC_ACADEMY_ROW_ART_T3
	}
	text = {
		trigger = { check_variable = { wc_artillery_tier = 2 } }
		localization_key = WC_ACADEMY_ROW_ART_T2
	}
	text = {
		localization_key = WC_ACADEMY_ROW_ART_T1
	}
}
defined_text = {
	name = GetWcAcademyArmorRowLabel
	text = {
		trigger = { check_variable = { wc_armor_tier = 3 } }
		localization_key = WC_ACADEMY_ROW_ARM_T3
	}
	text = {
		trigger = { check_variable = { wc_armor_tier = 2 } }
		localization_key = WC_ACADEMY_ROW_ARM_T2
	}
	text = {
		localization_key = WC_ACADEMY_ROW_ARM_T1
	}
}
defined_text = {
	name = GetWcAcademyOperationalRowLabel
	text = {
		trigger = { check_variable = { wc_operational_tier = 3 } }
		localization_key = WC_ACADEMY_ROW_OPS_T3
	}
	text = {
		trigger = { check_variable = { wc_operational_tier = 2 } }
		localization_key = WC_ACADEMY_ROW_OPS_T2
	}
	text = {
		localization_key = WC_ACADEMY_ROW_OPS_T1
	}
}

# Active upgrade banner - which upgrade is running, days left.
# Each branch maps an upgrade id to a localised name. The day
# count is interpolated separately in the loc string.
defined_text = {
	name = GetWcActiveUpgradeName
	text = {
		trigger = { check_variable = { wc_active_upgrade_id = 1 } }
		localization_key = WC_UPGRADE_NAME_INF_TIER
	}
	text = {
		trigger = { check_variable = { wc_active_upgrade_id = 4 } }
		localization_key = WC_UPGRADE_NAME_ART_TIER
	}
	text = {
		trigger = { check_variable = { wc_active_upgrade_id = 7 } }
		localization_key = WC_UPGRADE_NAME_ARM_TIER
	}
	text = {
		trigger = { check_variable = { wc_active_upgrade_id = 10 } }
		localization_key = WC_UPGRADE_NAME_OPS_TIER
	}
	text = {
		trigger = { check_variable = { wc_active_upgrade_id = 13 } }
		localization_key = WC_UPGRADE_NAME_UNLOCK_SLOTS
	}
	text = {
		trigger = { check_variable = { wc_active_upgrade_id = 14 } }
		localization_key = WC_UPGRADE_NAME_UNLOCK_SPIRIT
	}
	text = {
		trigger = { check_variable = { wc_active_upgrade_id = 15 } }
		localization_key = WC_UPGRADE_NAME_UNLOCK_THEORIST
	}
	text = {
		trigger = { check_variable = { wc_active_upgrade_id = 16 } }
		localization_key = WC_UPGRADE_NAME_SPEED
	}
	text = {
		localization_key = WC_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.
# This mirrors the unit-stats screenshot's information-heavy layout.
defined_text = {
	name = GetWcAcademyStatsText
	text = {
		localization_key = WC_ACADEMY_STATS_BODY
	}
}

# Per-fragment helpers consumed by WC_ACADEMY_STATS_BODY's
# interpolated calls.
defined_text = {
	name = GetWcAcademyStatsSpirit
	text = {
		trigger = { check_variable = { wc_academy_spirit_unlocked = 1 } }
		localization_key = WC_ACADEMY_STATS_SPIRIT_ON
	}
	text = {
		localization_key = WC_ACADEMY_STATS_SPIRIT_OFF
	}
}
defined_text = {
	name = GetWcAcademyStatsTheorist
	text = {
		trigger = { check_variable = { wc_academy_theorist_unlocked = 1 } }
		localization_key = WC_ACADEMY_STATS_THEORIST_ON
	}
	text = {
		localization_key = WC_ACADEMY_STATS_THEORIST_OFF
	}
}
defined_text = {
	name = GetWcAcademyStatsSlots
	text = {
		trigger = { check_variable = { wc_academy_slots_unlocked = 1 } }
		localization_key = WC_ACADEMY_STATS_SLOTS_ON
	}
	text = {
		localization_key = WC_ACADEMY_STATS_SLOTS_OFF
	}
}
defined_text = {
	name = GetWcAcademyStatsSpeed
	text = {
		trigger = { check_variable = { wc_academy_speed_level = 3 } }
		localization_key = WC_ACADEMY_STATS_SPEED_3
	}
	text = {
		trigger = { check_variable = { wc_academy_speed_level = 2 } }
		localization_key = WC_ACADEMY_STATS_SPEED_2
	}
	text = {
		trigger = { check_variable = { wc_academy_speed_level = 1 } }
		localization_key = WC_ACADEMY_STATS_SPEED_1
	}
	text = {
		localization_key = WC_ACADEMY_STATS_SPEED_0
	}
}