Fix tier-chain warning to distinguish lineage mismatch vs missing intermediate tier
Previously all gaps produced "X is missing" — but if the missing previous tier is Tier 1 and is not the deck's primary, the player can never add it (Tier 1 ArchSpirits are blocked from the card list). The message was technically correct but actionably wrong. Two distinct messages now: - Different lineage: "X (Tier N) belongs to a different ArchSpirit lineage than your primary and cannot be ascended to in this deck." - Missing intermediate: "X (Tier N) is in the deck but Y is missing. Add the intermediate tier to enable ascension." Generated with [Claude Code](https://claude.ai/code) via [Happy](https://happy.engineering) Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Happy <yesreply@happy.engineering>
This commit is contained in:
@@ -112,20 +112,39 @@ internal abstract class CollectionHandlerBase
|
||||
|
||||
if (gapped.Count > 0)
|
||||
{
|
||||
var prevIds = gapped.Select(g => g.PreviousTierId!.Value).Distinct().ToList();
|
||||
var prevNames = await catalogDb.CardDefinitions
|
||||
var prevIds = gapped.Select(g => g.PreviousTierId!.Value).Distinct().ToList();
|
||||
var prevDefs = await catalogDb.CardDefinitions
|
||||
.Where(cd => prevIds.Contains(cd.Id))
|
||||
.ToDictionaryAsync(cd => cd.Id, cd => cd.Name, ct);
|
||||
.Select(cd => new { cd.Id, cd.Name, cd.Tier })
|
||||
.ToDictionaryAsync(cd => cd.Id, ct);
|
||||
|
||||
foreach (var g in gapped)
|
||||
{
|
||||
var prevName = g.PreviousTierId.HasValue
|
||||
? prevNames.GetValueOrDefault(g.PreviousTierId.Value,
|
||||
$"Tier {g.Tier - 1} prerequisite")
|
||||
: $"Tier {g.Tier - 1} prerequisite";
|
||||
warnings.Add(
|
||||
$"{g.Name} (Tier {g.Tier}) is in the deck but {prevName} is missing. " +
|
||||
"It cannot ascend in-game without its previous tier.");
|
||||
if (!g.PreviousTierId.HasValue) continue;
|
||||
prevDefs.TryGetValue(g.PreviousTierId.Value, out var prev);
|
||||
|
||||
// Different lineage: the missing previous tier is a Tier-1 root
|
||||
// that is not this deck's primary ArchSpirit. The card can never
|
||||
// be ascended to because the ascension chain starts from the wrong
|
||||
// primary.
|
||||
bool isDifferentLineage =
|
||||
prev?.Tier == 1 &&
|
||||
g.PreviousTierId.Value != deck.ArchSpiritCardDefinitionId;
|
||||
|
||||
if (isDifferentLineage)
|
||||
{
|
||||
warnings.Add(
|
||||
$"{g.Name} (Tier {g.Tier}) belongs to a different ArchSpirit " +
|
||||
"lineage than your primary and cannot be ascended to in this deck.");
|
||||
}
|
||||
else
|
||||
{
|
||||
// Same lineage but an intermediate tier is missing.
|
||||
var prevName = prev?.Name ?? $"Tier {g.Tier - 1} prerequisite";
|
||||
warnings.Add(
|
||||
$"{g.Name} (Tier {g.Tier}) is in the deck but {prevName} is " +
|
||||
"missing. Add the intermediate tier to enable ascension.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user