using System.Collections.Generic;
namespace TKS.OutGame
{
///
/// 플레이 테스트 전용 출전 편성(PD 2026-11-18 「기준 스펙 편성」 · TestOptions):
/// 기준 편성(영웅 id 목록 · 보유 무관)이 있으면 그 영웅들 · 없으면 내 편성 그대로 →
/// 기준 스펙이 켜져 있으면 능력치 = 병종 기본 × 영웅 고유 배율(성장 무시) · 스킬 Lv1 = 레벨디자인 측정(LevelSimTests spec 1.0)과 같은 조건.
/// 자리 = 근접 병종 먼저(전열 0~2) · 원거리 뒤(후열 3~4). 옵션이 모두 꺼져 있으면 lineup 그대로 돌려준다.
///
public static class TestLineup
{
public static List Apply(OutGameSession s, List lineup)
{
bool spec = TestOptions.StandardSpec;
string ids = TestOptions.LineupIds;
if (s == null || (!spec && string.IsNullOrEmpty(ids))) return lineup;
var heroes = new List();
if (!string.IsNullOrEmpty(ids))
{
foreach (var id in ids.Split(';'))
{
var h = s.Def(id.Trim());
if (h != null && heroes.Count < s.FormationSlots) heroes.Add(h);
}
}
if (heroes.Count == 0)
{
if (!spec) return lineup;
foreach (var e in lineup)
{
var h = s.Def(e.id);
if (h != null) heroes.Add(h);
}
}
if (!string.IsNullOrEmpty(ids)) heroes.Sort((a, b) => UnitTypeInfo.IsRanged(a.type).CompareTo(UnitTypeInfo.IsRanged(b.type)));
var res = new List();
for (int i = 0; i < heroes.Count; i++)
{
var h = heroes[i];
LineupEntry old = lineup.Find(x => x.id == h.id);
LineupEntry e;
if (spec || old == null)
{
e = new LineupEntry
{
slot = old != null && string.IsNullOrEmpty(ids) ? old.slot : i, id = h.id, name = h.nameKo, type = h.type, art = h.art,
hpMult = h.hpMult, atkMult = h.atkMult, defMult = h.defMult, // 기준 스펙 = 성장 계수 1(보유 안 한 영웅도 같음)
};
SkillRules.FillLineup(s.Db, s.Save, h, e);
if (spec)
{
e.activeLv = 1;
e.passiveLv = 1;
}
}
else
{
e = old;
e.slot = i;
}
res.Add(e);
}
return res;
}
}
}