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
+21 -14
View File
@@ -33,7 +33,7 @@ namespace KernelPanic.UI
{
_overlay = overlay; _run = run; _combat = combat; _cards = cards; _languages = languages;
_save = save; _lesson = config.TutorialLesson; _returnToMenu = returnToMenu;
_resuming = _lesson == 2;
_resuming = _lesson > 1;
SetGuide(_lesson);
}
@@ -56,7 +56,7 @@ namespace KernelPanic.UI
{
if (!_resuming) return;
_resuming = false;
if (!_combat.ContinueTutorialWave()) throw new InvalidDataException("Training checkpoint is not a purchased first-wave shop.");
if (!_combat.ContinueTutorialWave()) throw new InvalidDataException("Training checkpoint is not a completed lesson boundary.");
}
public void Refresh()
@@ -78,14 +78,15 @@ namespace KernelPanic.UI
_overlay.Clear(); _overlay.style.display = DisplayStyle.None; _renderKey = null;
return;
}
if (cleared && _lesson == 1 && !_run.RepositoryVisitActive)
if (cleared && _lesson < TutorialCampaign.LessonCount && !_run.RepositoryVisitActive)
_run.GenerateRepositoryOffers(_cards, _languages);
bool purchased = _run.RepositoryOffers.Any(offer => offer.Sold);
string key = $"{_lesson}:{cleared}:{lost}:{_shopStep}:{purchased}:{_error}";
if (_renderKey == key) return;
_renderKey = key;
_overlay.Clear(); _overlay.AddToClassList("tutorial-overlay"); _overlay.style.display = DisplayStyle.Flex;
var panel = TerminalLayout.Section(lost ? "Practice ended" : _lesson == 1 ? "Wave one cleared / repository" : "Training complete", "TutorialDialog");
var panel = TerminalLayout.Section(lost ? "Practice ended" : _lesson == 1 ? "Wave one cleared / repository"
: _lesson < TutorialCampaign.LessonCount ? "Wave two cleared" : "Training complete", "TutorialDialog");
panel.AddToClassList("tutorial-dialog");
var scroll = new ScrollView(ScrollViewMode.Vertical) { name = "TutorialCopy" };
scroll.style.flexShrink = 1; scroll.style.minHeight = 0;
@@ -93,7 +94,7 @@ namespace KernelPanic.UI
Button action;
if (lost)
{
scroll.Add(TerminalLayout.BodyText("Try again. Wave two restarts from your saved shop purchase; wave one restarts with full Uptime. Your collection is safe."));
scroll.Add(TerminalLayout.BodyText("Retry this wave from its start. Your purchased upgrade is saved; your collection is safe."));
action = new Button(RestartLesson) { text = "Retry training", name = "TutorialRetry" };
}
else if (_lesson == 1)
@@ -102,7 +103,7 @@ namespace KernelPanic.UI
if (_shopStep == 0)
{
bits.AddToClassList("tutorial-shop-highlight");
scroll.Add(TerminalLayout.BodyText("Every enemy is gone. Between waves, the repository is your shop. Spend Bits earned in combat to improve this run; Bits are separate from your permanent currencies."));
scroll.Add(TerminalLayout.BodyText("Spend combat Bits here to improve this run. Your permanent currencies are separate."));
action = new Button(() => { _shopStep = 1; Redraw(); }) { text = "Show an upgrade", name = "TutorialShopNext" };
}
else
@@ -118,15 +119,21 @@ namespace KernelPanic.UI
{ text = purchased ? "Purchased" : $"Buy / {offer.Price} Bits", name = "TutorialBuy" };
buy.SetEnabled(!purchased && _run.Bits >= offer.Price); item.Add(buy);
scroll.Add(TerminalLayout.BodyText(purchased
? "Upgrade installed. Your remaining Uptime, deck and purchase carry into wave two. Normal shops also sell new cards and stat upgrades."
? "Upgrade installed. Your Uptime, deck and patch carry into wave two."
: "Buy this upgrade to practice spending Bits. Then start the next wave."));
action = new Button(Continue) { text = "Start wave two", name = "TutorialContinue" };
action.SetEnabled(purchased);
}
}
else if (_lesson < TutorialCampaign.LessonCount)
{
scroll.Add(TerminalLayout.BodyText("Queue and stack mastered. One last practice: Cron Job's countdown and a Daemon miniboss."));
scroll.Add(TerminalLayout.BodyText("Continue to save your progress and restore full Uptime for the final practice."));
action = new Button(Continue) { text = "Start wave three", name = "TutorialContinue" };
}
else
{
scroll.Add(TerminalLayout.BodyText("Both waves are clear. You have completed the combat → shop → combat loop."));
scroll.Add(TerminalLayout.BodyText("All three waves cleared. You're ready for a campaign."));
scroll.Add(TerminalLayout.Heading($"+{TutorialCampaign.BandwidthReward:N0} Bandwidth"));
scroll.Add(TerminalLayout.Heading($"+{TutorialCampaign.EntropyReward:N0} Entropy"));
scroll.Add(TerminalLayout.BodyText("Enough Entropy for one standard 10-pull. This training reward is granted once per profile."));
@@ -143,22 +150,22 @@ namespace KernelPanic.UI
{
if (_leaving || Guide.Active || !_combat.AwaitingWaveContinue || _combat.RunFinished) return;
if (_lesson == 1 && !_run.RepositoryOffers.Any(offer => offer.Sold)) return;
if (_lesson == 2 && _run.WavesCleared < 2) return;
if (_run.WavesCleared < _lesson) return;
try
{
var data = _save.Load();
if (!TutorialCampaign.Required(data)) throw new InvalidOperationException("Training is not active.");
if (_lesson == 1)
if (_lesson < TutorialCampaign.LessonCount)
{
data.tutorialCheckpoint = _run.CaptureCheckpoint(_combat);
data.tutorialLesson = 2;
data.tutorialLesson = _lesson + 1;
}
else TutorialCampaign.Complete(data);
_save.Save(data);
_error = null;
if (_lesson == 2) { _leaving = true; _returnToMenu(); return; }
_lesson = 2; SetGuide(2);
if (!_combat.ContinueTutorialWave()) throw new InvalidOperationException("Wave two could not start. Restart to resume the saved shop.");
if (_lesson == TutorialCampaign.LessonCount) { _leaving = true; _returnToMenu(); return; }
_lesson++; SetGuide(_lesson);
if (!_combat.ContinueTutorialWave()) throw new InvalidOperationException("Training could not continue. Restart to resume the saved wave.");
Redraw();
}
catch (Exception ex) when (ex is IOException || ex is UnauthorizedAccessException || ex is InvalidOperationException || ex is OverflowException)