Add tutorial and QoL improvements

This commit is contained in:
2026-10-24 00:52:14 +02:00
parent ac48c24a03
commit ec3e784683
53 changed files with 3526 additions and 939 deletions
+25 -33
View File
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using KernelPanic.Combat;
using KernelPanic.Core;
using KernelPanic.Data;
@@ -742,7 +743,7 @@ namespace KernelPanic.UI
private static int GetDistroStars(DistroDefinition unit)
{
return unit != null && string.Equals(unit.Id, "arch", StringComparison.OrdinalIgnoreCase) ? 5 : 4;
return DistroRarity.Stars(unit);
}
private static Color GetLanguageColor(Language language)
@@ -948,14 +949,14 @@ namespace KernelPanic.UI
private void AddUnitOverviewTab(VisualElement target, DistroDefinition unit)
{
Label identityTitle = new("identity");
identityTitle.AddToClassList("detail-section-title");
target.Add(identityTitle);
target.Add(BuildDetailLine("lang", DistroPresentation.FormatLanguages(unit)));
VisualElement identity = TerminalLayout.Section("identity",
sectionClass: "unit-info-section unit-identity-section", headingClass: "detail-section-title");
identity.Add(BuildDetailLine("lang", DistroPresentation.FormatLanguages(unit)));
Label description = new(string.IsNullOrWhiteSpace(unit.Description) ? "--" : unit.Description);
description.AddToClassList("collection-detail-description");
target.Add(description);
Label description = TerminalLayout.BodyText(string.IsNullOrWhiteSpace(unit.Description) ? "--" : unit.Description,
className: "collection-detail-description");
identity.Add(description);
target.Add(identity);
AddPassiveDetails(target, unit);
VisualElement readout = new();
@@ -1147,8 +1148,7 @@ namespace KernelPanic.UI
return;
}
PackageEffectData effect = package.EffectFor(unit.Id);
if (package.Slot == PackageSlot.Kernel && IsStatPackageEffect(effect.Kind))
if (package.Slot == PackageSlot.Kernel && package.EffectsFor(unit.Id).All(e => IsStatPackageEffect(e.Kind)))
{
return;
}
@@ -1838,17 +1838,7 @@ namespace KernelPanic.UI
private static VisualElement BuildDetailLine(string key, string value)
{
VisualElement row = new();
row.AddToClassList("kv-row");
Label keyLabel = new(key);
keyLabel.AddToClassList("kv-key");
Label valueLabel = new(value);
valueLabel.AddToClassList("kv-value");
row.Add(keyLabel);
row.Add(valueLabel);
return row;
return TerminalLayout.StatRow(key, value, rowClass: "kv-row", keyClass: "kv-key", valueClass: "kv-value");
}
private static VisualElement BuildPackagePreviewLine(string key, string value)
@@ -1923,20 +1913,17 @@ namespace KernelPanic.UI
return;
}
Label passiveTitle = new(unit.Passive.Name);
passiveTitle.AddToClassList("detail-section-title");
target.Add(passiveTitle);
Label passiveRules = new(unit.Passive.RulesText);
passiveRules.AddToClassList("collection-detail-description");
target.Add(passiveRules);
VisualElement passive = TerminalLayout.Section(unit.Passive.Name,
sectionClass: "unit-info-section unit-passive-section", headingClass: "detail-section-title");
Label passiveRules = TerminalLayout.BodyText(unit.Passive.RulesText, className: "collection-detail-description");
passive.Add(passiveRules);
if (!string.IsNullOrWhiteSpace(unit.Passive.FlavorText))
{
Label passiveFlavor = new(unit.Passive.FlavorText);
passiveFlavor.AddToClassList("flavor-text");
target.Add(passiveFlavor);
Label passiveFlavor = TerminalLayout.BodyText(unit.Passive.FlavorText, className: "flavor-text");
passive.Add(passiveFlavor);
}
target.Add(passive);
}
private static IReadOnlyList<CardEntry> BuildUnitCardEntries(DistroDefinition unit)
@@ -2065,7 +2052,7 @@ namespace KernelPanic.UI
return "--";
}
string summary = FormatEffectSummary(package.EffectFor(distroId), upgradeLevel);
string summary = string.Join("; ", package.EffectsFor(distroId).Select(e => FormatEffectSummary(e, upgradeLevel)).Where(s => !string.IsNullOrWhiteSpace(s)));
if (!string.IsNullOrWhiteSpace(summary))
{
return summary;
@@ -2081,7 +2068,7 @@ namespace KernelPanic.UI
return string.Empty;
}
string text = FormatEffectSummary(package.EffectFor(distroId), upgradeLevel);
string text = FormatPackageEffect(package, upgradeLevel, distroId);
if (string.IsNullOrWhiteSpace(text) && !string.IsNullOrWhiteSpace(package.Description))
{
text = package.Description.Trim();
@@ -2103,6 +2090,11 @@ namespace KernelPanic.UI
return effect.Kind switch
{
PackageEffectKind.None => string.Empty,
PackageEffectKind.PortageWaveStartShield => $"+{Math.Max(4, amount)} Shield once at wave start",
PackageEffectKind.FirstCardEachRoundDiscountAndShield => "first accepted card each round costs 1 less" + (amount > 0 ? $"; +{amount} Shield on its successful play" : string.Empty),
PackageEffectKind.CompilationAdvancedPreviousRoundCycle => $"+{amount} Cycle at round start if Compilation advanced last round",
PackageEffectKind.AfterFirstRoundShield => $"+{amount} Shield at each round start after the first",
PackageEffectKind.AfterFirstRoundCompilation => $"+{amount} Compilation at each round start after the first (version cap; no increase hooks)",
PackageEffectKind.MaxUptime => $"+{amount} max Uptime",
PackageEffectKind.MaxCycles => $"+{amount} max Cycles",
PackageEffectKind.MaxRam => $"+{amount} max RAM",