Add NixOS and Go

This commit is contained in:
2026-10-27 11:35:32 +01:00
parent 881b61a66d
commit 97d2685302
64 changed files with 1295 additions and 204 deletions
+17 -3
View File
@@ -12,6 +12,8 @@ namespace KernelPanic.Run
{
public readonly string Id, Title, Copy, Anchor;
public readonly TutorialAction Action;
public string CardId { get; internal set; }
public int TargetSlot { get; internal set; }
public TutorialStep(string id, string title, string copy, string anchor, TutorialAction action = TutorialAction.Read)
{ Id = id; Title = title; Copy = copy; Anchor = anchor; Action = action; }
}
@@ -20,6 +22,7 @@ namespace KernelPanic.Run
public sealed class TutorialGuide
{
private readonly int _lesson;
private readonly Language? _language;
private readonly IReadOnlyList<TutorialStep> _steps;
private bool _played, _resolved, _ended;
public int Index { get; private set; }
@@ -30,10 +33,12 @@ namespace KernelPanic.Run
public CardInstance Card { get; private set; }
public EnemyInstance Enemy { get; private set; }
public bool CanEndTurn => !Active || Step.Action == TutorialAction.EndTurn;
private ResolutionTrack ExpectedTrack => _lesson != 2 ? ResolutionTrack.Native
private ResolutionTrack ExpectedTrack => _language.HasValue ? Card?.Definition.ResolutionTrack ?? ResolutionTrack.Native
: _lesson != 2 ? ResolutionTrack.Native
: Step?.Id.Contains("haskell") == true ? ResolutionTrack.LazyStack : ResolutionTrack.InterpreterQueue;
public TutorialGuide(int lesson) { _lesson = lesson; _steps = Build(lesson); }
public TutorialGuide(Language language) { _language = language; _steps = LanguageTraining.BuildSteps(language); }
public bool AllowsCard(CardInstance card) => !Active || !Reading && ReferenceEquals(card, Card)
&& Step.Action is TutorialAction.SelectCard or TutorialAction.TargetEnemy or TutorialAction.PlayShield;
@@ -102,6 +107,15 @@ namespace KernelPanic.Run
private void PickReferences(CombatManager combat)
{
if (!Active) return;
if (_language.HasValue)
{
Enemy = combat.Enemies.ElementAtOrDefault(Step.TargetSlot);
if (Enemy == null || Enemy.State.IsDefeated)
Enemy = combat.Enemies.FirstOrDefault(enemy => !enemy.State.IsDefeated);
if (Card == null && Step.CardId != null && combat.HandController != null)
Card = combat.HandController.Cards.FirstOrDefault(card => card.Definition.Id == Step.CardId);
return;
}
if (Enemy == null)
Enemy = combat.Enemies.FirstOrDefault(enemy => _lesson == 1 ? enemy.ArchetypeId == "zombie_process"
: _lesson == 3 ? enemy.ArchetypeId == "daemon" : true);
@@ -152,8 +166,8 @@ namespace KernelPanic.Run
return new[] {
new TutorialStep("leak", "A new threat: Memory Leak", "Memory Leak grows stronger each round and applies damage over time. Your purchased patch carried over.", "enemy:memory_leak"),
new TutorialStep("firewall", "A protector: firewalld", "firewalld shields itself and its neighbors. Check its intent before choosing a target.", "enemy:firewalld"),
new TutorialStep("queue-intro", "Python builds a pipeline", "Preparation acts immediately. Payloads and modifiers wait until End turn, oldest first (FIFO). Scripts run before the queue.", "TutorialQueue"),
new TutorialStep("select-python", "Select the Python card", "Click print(), then choose the highlighted enemy. This payload can later be repeated by for loop or spread by zip.", "card", TutorialAction.SelectCard),
new TutorialStep("queue-intro", "Delayed cards / the queue", "Queued cards wait until End turn, then resolve oldest first (FIFO). Optional language fights teach combos from your collection.", "TutorialQueue"),
new TutorialStep("select-python", "Try a payload / print()", "This training hand has print(). Select it, then choose the highlighted enemy to see how a payload enters the queue.", "card", TutorialAction.SelectCard),
new TutorialStep("target-python", "Select a target", "Click the highlighted enemy to complete this play.", "enemy", TutorialAction.TargetEnemy),
new TutorialStep("queued-python", "Python is waiting here", "The card is queued, not resolved. With multiple entries, the oldest executes first.", "TutorialQueue"),
new TutorialStep("stack-intro", "Haskell uses the stack", "Haskell resolves after Python, newest first (LIFO). Its entry multiplier scales damage and Shield.", "TutorialStack"),