Implement more QoL features and rebalances

This commit is contained in:
2026-10-25 02:16:30 +02:00
parent 0578913451
commit 53f831d91e
220 changed files with 14700 additions and 420 deletions
+44 -17
View File
@@ -14,6 +14,8 @@ namespace KernelPanic.UI
private readonly Label _title = new();
private readonly Label _instruction = new();
private readonly Label _receipt = new();
private readonly VisualElement _resources = new();
private readonly Foldout _tracks = new() { text = "Resources & turn order", value = false };
private readonly Button _action;
private readonly Button _skip;
private RunConfig _config;
@@ -36,12 +38,18 @@ namespace KernelPanic.UI
header.AddToClassList("guide-header");
header.Add(_title);
Element.Add(header);
_resources.AddToClassList("guide-resources");
foreach (string text in new[] { "Uptime\nHealth", "Shield\nProtection", "Cycles\nCard budget", "RAM\nHand space" })
{
var chip = new Label(text); chip.AddToClassList("guide-resource"); _resources.Add(chip);
}
Element.Add(_instruction);
Element.Add(_receipt);
Element.Add(_tracks);
var actions = new VisualElement();
actions.AddToClassList("guide-actions");
_action = new Button(Advance) { text = "Ready: play a card" };
_skip = new Button(Dismiss) { text = "Skip guide" };
_action = new Button(Advance) { text = "Try a card" };
_skip = new Button(Dismiss) { text = "Close guide" };
actions.Add(_action);
actions.Add(_skip);
header.Add(actions);
@@ -57,9 +65,18 @@ namespace KernelPanic.UI
Element.style.display = DisplayStyle.Flex;
_action.style.display = DisplayStyle.Flex;
_skip.style.display = DisplayStyle.Flex;
_action.text = "Ready: play a card";
_title.text = "First battle / 1 of 4 / read the process table";
_instruction.text = "Uptime = health; Cycles = card budget; RAM = hand capacity. Read enemy intents, then select a card and its target. " + TrackLesson(config);
_action.text = "Try a card";
_resources.style.display = DisplayStyle.Flex;
_tracks.Clear(); _tracks.value = false;
_tracks.Add(_resources);
AddTrack("NOW / Native", "Executes when played.");
if (config?.PrimaryLanguage == Language.Python || config?.SecondaryLanguage == Language.Python)
AddTrack("1 / Python queue", "End turn: oldest first.");
if (config?.PrimaryLanguage == Language.Haskell || config?.SecondaryLanguage == Language.Haskell)
AddTrack("2 / Haskell stack", "After the queue: newest first. Entry multiplier scales damage and Shield.");
AddTrack("LAST / Enemies", "Surviving enemies carry out their intents.");
_title.text = "1 / Read the battlefield";
_instruction.text = "Check enemy intents before you spend your Cycles.";
}
public void Advance()
@@ -68,8 +85,8 @@ namespace KernelPanic.UI
if (_completed) { Dismiss(); return; }
_started = true;
_action.style.display = DisplayStyle.None;
_title.text = "First battle / 2 of 4 / dispatch a card";
_instruction.text = "Play any affordable card. Targeted cards need a living process selected. The preview explains its current effect. " + TrackLesson(_config);
_title.text = "2 / Play a card";
_instruction.text = "Select an affordable card, then its enemy target if needed. Check the preview before dispatching.";
}
public void CardPlayed(ResolutionTrack track, string name)
@@ -77,14 +94,14 @@ namespace KernelPanic.UI
if (!Visible || _completed) return;
_played = _started = true;
_action.style.display = DisplayStyle.None;
_title.text = "First battle / 3 of 4 / finish your turn";
_title.text = "3 / End turn";
_receipt.text = track switch
{
ResolutionTrack.InterpreterQueue => name + " entered the queue. It waits until end turn; the oldest queued card resolves first.",
ResolutionTrack.LazyStack => name + " entered the stack. It waits until after the queue; the newest stacked card resolves first.",
_ => name + " executes immediately on the Native track."
ResolutionTrack.InterpreterQueue => name + " queued / oldest first.",
ResolutionTrack.LazyStack => name + " stacked / newest first.",
_ => name + " / executes now."
};
_instruction.text = "Play more cards if you have Cycles, then choose [E] end turn. Watch the scheduler: queue first, stack second, then enemies act. Shield helps absorb incoming damage.";
_instruction.text = "Spend any remaining Cycles, then press [E] End turn. Shield absorbs incoming damage.";
}
public void CardResolved(string name, ResolutionTrack track)
@@ -99,7 +116,7 @@ namespace KernelPanic.UI
if (phase == TurnPhase.Interpret)
{
_endedTurn = true;
_instruction.text = "Resolving: queued cards execute oldest first, then stacked cards execute newest first. Enemy actions follow. You can inspect the journal for the result of each operation.";
_instruction.text = "Queue: oldest first → Stack: newest first → Enemies.";
}
if (phase == TurnPhase.Execute && _endedTurn) Complete(false);
}
@@ -113,11 +130,13 @@ namespace KernelPanic.UI
private void Complete(bool waveCleared)
{
_completed = true;
_title.text = "First battle / 4 of 4 / plan the next round";
_title.text = waveCleared ? "4 / Wave cleared" : "4 / Reassess";
_instruction.text = waveCleared
? "Wave cleared! Spend Bits in the repository on cards, upgrades or healing, then continue. Cleared waves earn rewards that are banked when the run ends."
: "Check Uptime, Shield and the next enemy intents before your next move. Each completed round refreshes your turn resources. " + (_config?.Distro?.Id == "gentoo" ? "Gentoo's Compilation advances after a completed round, improving damage (and Shield at higher versions), and resets each wave. " : "") + "You can reopen this with '? guide' in dispatch.";
if (!_played && _started) _receipt.text = "You can also end a turn without playing a card; the same execution order applies.";
? "Spend Bits in the repository on cards, upgrades or healing. Then continue your run."
: "Check your Uptime, Shield and next enemy intents. Your turn resources have refreshed.";
_receipt.text = _config?.Distro?.Id == "gentoo" && !waveCleared
? "Compilation grew this round; it resets each wave."
: !_played && _started ? "Ending a turn without playing a card is allowed." : "Reopen anytime with ? guide.";
_action.text = "Got it";
_action.style.display = DisplayStyle.Flex;
_skip.style.display = DisplayStyle.None;
@@ -129,6 +148,14 @@ namespace KernelPanic.UI
_remember();
}
private void AddTrack(string title, string copy)
{
var row = new VisualElement(); row.AddToClassList("guide-track");
var heading = new Label(title); heading.AddToClassList("guide-title"); row.Add(heading);
var detail = new Label(copy); detail.AddToClassList("guide-copy"); row.Add(detail);
_tracks.Add(row);
}
public static string TrackLesson(RunConfig config)
{
string lesson = "Native cards execute now.";